1 // Copyright (c) 1993-1999 Matra Datavision
2 // Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
22 // OCC6794: if OptJr is ON, we need to ensure that memory allocations are done by 4 bytes words,
23 // in order to avoid writing into unallocated memory at the string end when it is copied
24 // by CSTRINGCOPY or ASCIISTRINGCOPY macros
25 // (though, due to OCC memory manager roundings of allocated memory, the problem appears
26 // only when MMGT_OPT is 0 and string size is greater than MMGT_THRESHOLD)
28 #define ROUNDMEM(len) (((len)+3)&~0x3)
30 #define ROUNDMEM(len) (len)
33 //#if defined(WNT) || defined(LIN)
37 #include <TCollection_AsciiString.ixx>
38 #include <Standard.hxx>
39 #include <Standard_NullObject.hxx>
40 #include <Standard_OutOfRange.hxx>
41 #include <Standard_NegativeValue.hxx>
42 #include <Standard_NumericError.hxx>
43 #include <Standard_ctype.hxx>
44 #include <Standard_String.hxx>
46 #include <TCollection_ExtendedString.hxx>
48 // ###### PLACER LE TYPE NON DEFINI strtol (portabilite) ######
53 long strtol(const char*, char**, int);
57 // Shortcuts to standard allocate and reallocate functions
58 static inline Standard_PCharacter Allocate(const Standard_Size aLength)
60 return (Standard_PCharacter)Standard::Allocate (aLength);
62 static inline Standard_PCharacter Reallocate (Standard_Address aAddr,
63 const Standard_Size aLength)
65 return (Standard_PCharacter)Standard::Reallocate (aAddr, aLength);
68 // ----------------------------------------------------------------------------
69 // Create an empty AsciiString
70 // ----------------------------------------------------------------------------
71 TCollection_AsciiString::TCollection_AsciiString()
75 mystring = Allocate(mylength+1);
76 mystring[mylength] = '\0';
80 // ----------------------------------------------------------------------------
81 // Create an asciistring from a Standard_CString
82 // ----------------------------------------------------------------------------
83 TCollection_AsciiString::TCollection_AsciiString(const Standard_CString astring)
88 STRINGLEN( astring , mylength ) ;
90 STRLEN(astring,mylength);
92 mystring = Allocate(ROUNDMEM(mylength+1));
94 CSTRINGCOPY( mystring , astring , mylength ) ;
96 STRCPY(mystring,astring,mylength);
97 mystring[mylength] = '\0';
101 Standard_NullObject::Raise("TCollection_AsciiString : parameter 'astring'");
105 // ----------------------------------------------------------------------------
106 // Create an asciistring from a Standard_CString
107 // ----------------------------------------------------------------------------
108 TCollection_AsciiString::TCollection_AsciiString(const Standard_CString astring,
109 const Standard_Integer aLen )
114 mystring = Allocate(ROUNDMEM(mylength+1));
115 CSTRINGCOPY( mystring , astring , mylength ) ;
116 mystring [ mylength ] = '\0' ;
119 Standard_NullObject::Raise("TCollection_AsciiString : parameter 'astring'");
123 // ----------------------------------------------------------------------------
124 // Create an asciistring from a Standard_Character
125 // ----------------------------------------------------------------------------
126 TCollection_AsciiString::TCollection_AsciiString(const Standard_Character aChar)
129 if ( aChar != '\0' ) {
131 mystring = Allocate(2);
137 mystring = Allocate(mylength+1);
138 mystring[mylength] = '\0';
142 // ----------------------------------------------------------------------------
143 // Create an AsciiString from a filler
144 // ----------------------------------------------------------------------------
145 TCollection_AsciiString::TCollection_AsciiString(const Standard_Integer length,
146 const Standard_Character filler )
148 mystring = Allocate(length+1);
150 for (int i = 0 ; i < length ; i++) mystring[i] = filler;
151 mystring[length] = '\0';
154 // ----------------------------------------------------------------------------
155 // Create an AsciiString from an Integer
156 // ----------------------------------------------------------------------------
157 TCollection_AsciiString::TCollection_AsciiString(const Standard_Integer aValue)
161 union { int bid ; // ?? to ensure alignment of t[] by double-word??
163 Sprintf(&CHN.t[0],"%d",aValue);
165 STRINGLEN( CHN.t , mylength ) ;
167 STRLEN(CHN.t,mylength);
169 mystring = Allocate(ROUNDMEM(mylength+1));
171 ASCIISTRINGCOPY( mystring , CHN.t , mylength ) ;
173 STRCPY(mystring,CHN.t,mylength);
174 mystring[mylength] = '\0';
178 // ----------------------------------------------------------------------------
179 // Create an asciistring from a real
180 // ----------------------------------------------------------------------------
181 TCollection_AsciiString::TCollection_AsciiString(const Standard_Real aValue)
187 Sprintf(&CHN.t[0],"%g",aValue);
189 STRINGLEN( CHN.t , mylength ) ;
191 STRLEN(CHN.t,mylength);
193 mystring = Allocate(ROUNDMEM(mylength+1));
195 ASCIISTRINGCOPY( mystring , CHN.t , mylength ) ;
197 STRCPY(mystring,CHN.t,mylength);
198 mystring[mylength] = '\0';
202 // ----------------------------------------------------------------------------
203 // Create an asciistring from an asciistring
204 // ----------------------------------------------------------------------------
205 TCollection_AsciiString::TCollection_AsciiString(const TCollection_AsciiString& astring)
209 mylength = astring.mylength;
210 mystring = Allocate(ROUNDMEM(mylength+1));
211 if ( astring.mystring ) {
213 ASCIISTRINGCOPY( mystring , astring.mystring , mylength ) ;
217 STRCPY(mystring,astring.mystring,mylength);
220 mystring[mylength] = '\0';
223 // ----------------------------------------------------------------------------
224 // Create an asciistring from a character
225 // ----------------------------------------------------------------------------
226 TCollection_AsciiString::TCollection_AsciiString(
227 const TCollection_AsciiString& astring ,
228 const Standard_Character other )
232 mylength = astring.mylength + 1 ;
233 mystring = Allocate(ROUNDMEM(mylength+1));
234 if ( astring.mystring ) {
235 ASCIISTRINGCOPY( mystring , astring.mystring , astring.mylength ) ;
237 mystring[mylength-1] = other ;
238 mystring[mylength] = '\0' ;
241 // ----------------------------------------------------------------------------
242 // Create an asciistring from an asciistring
243 // ----------------------------------------------------------------------------
244 TCollection_AsciiString::TCollection_AsciiString(
245 const TCollection_AsciiString& astring ,
246 const Standard_CString other )
249 Standard_Integer otherlength;
251 STRINGLEN( other , otherlength );
252 mylength = astring.mylength + otherlength ;
253 mystring = Allocate(ROUNDMEM(mylength+1));
254 if ( astring.mystring ) {
255 ASCIISTRINGCOPY( mystring , astring.mystring , astring.mylength ) ;
257 STRINGCAT( mystring , astring.mylength , other , otherlength ) ;
260 // ----------------------------------------------------------------------------
261 // Create an asciistring from an asciistring
262 // ----------------------------------------------------------------------------
263 TCollection_AsciiString::TCollection_AsciiString(
264 const TCollection_AsciiString& astring ,
265 const TCollection_AsciiString& other )
269 mylength = astring.mylength + other.mylength ;
270 mystring = Allocate(ROUNDMEM(mylength+1));
271 if ( astring.mystring ) {
272 ASCIISTRINGCOPY( mystring , astring.mystring , astring.mylength ) ;
274 if ( other.mystring ) {
275 STRINGCAT( mystring , astring.mylength , other.mystring , other.mylength ) ;
282 //---------------------------------------------------------------------------
283 // Create an asciistring from an ExtendedString
284 //---------------------------------------------------------------------------
285 TCollection_AsciiString::TCollection_AsciiString(const TCollection_ExtendedString& astring,
286 const Standard_Character replaceNonAscii)
289 if (replaceNonAscii || astring.IsAscii()) {
290 mylength = astring.Length();
291 mystring = Allocate(mylength+1);
292 for(int i = 0; i < mylength; i++) {
293 Standard_ExtCharacter c = astring.Value(i+1);
294 mystring[i] = ( IsAnAscii(c) ? ToCharacter(c) : replaceNonAscii );
296 mystring[mylength] = '\0';
299 Standard_SStream amsg;
300 amsg << "It's not an ascii string : " ;
302 Standard_OutOfRange::Raise(amsg);
306 // ----------------------------------------------------------------------------
308 // ----------------------------------------------------------------------------
309 void TCollection_AsciiString::AssignCat(const Standard_Integer other)
312 AssignCat(TCollection_AsciiString(other));
316 // ----------------------------------------------------------------------------
318 // ----------------------------------------------------------------------------
319 void TCollection_AsciiString::AssignCat(const Standard_Real other)
322 AssignCat(TCollection_AsciiString(other));
326 // ----------------------------------------------------------------------------
328 // ----------------------------------------------------------------------------
329 void TCollection_AsciiString::AssignCat(const Standard_Character other)
333 mystring = Reallocate((void*&)mystring,
337 mystring = Allocate(mylength+2);
339 mystring[mylength] = other ;
341 mystring[mylength] = '\0';
345 // ----------------------------------------------------------------------------
347 // ----------------------------------------------------------------------------
348 void TCollection_AsciiString::AssignCat(const Standard_CString other)
351 if (other[0] != '\0') {
352 Standard_Integer otherlength;
354 STRINGLEN( other , otherlength ) ;
356 STRLEN(other,otherlength);
358 Standard_Integer newlength = mylength+otherlength;
360 mystring = Reallocate((void*&)mystring,
361 ROUNDMEM(newlength+1));
363 STRINGCAT( mystring , mylength , other , otherlength ) ;
365 STRCAT(mystring,mylength,other,otherlength);
369 mystring = Allocate(ROUNDMEM(newlength+1));
371 CSTRINGCOPY( mystring , other , newlength ) ;
373 STRCPY(mystring,other,newlength);
376 mylength = newlength;
378 mystring[mylength] = '\0';
383 Standard_NullObject::Raise("TCollection_AsciiString::Operator += parameter other");
387 // ----------------------------------------------------------------------------
389 // ----------------------------------------------------------------------------
390 void TCollection_AsciiString::AssignCat(const TCollection_AsciiString& other)
393 Standard_Integer otherlength = other.mylength;
395 Standard_CString sother = other.mystring;
396 Standard_Integer newlength = mylength+otherlength;
398 mystring = Reallocate((void*&)mystring,
399 ROUNDMEM(newlength+1));
401 STRINGCAT( mystring , mylength , sother , otherlength ) ;
403 STRCAT(mystring,mylength,sother,otherlength);
407 mystring =Allocate(ROUNDMEM(newlength+1));
409 ASCIISTRINGCOPY( mystring , sother , newlength ) ;
411 STRCPY(mystring,sother,newlength);
414 mylength = newlength;
416 mystring[mylength] = '\0';
421 // ---------------------------------------------------------------------------
423 // ----------------------------------------------------------------------------
424 void TCollection_AsciiString::Capitalize()
426 for (int i=0; i < mylength; i++) {
427 if ( i==0 ) mystring[i] = ::UpperCase(mystring[i]);
428 else mystring[i] = ::LowerCase(mystring[i]);
432 // ---------------------------------------------------------------------------
434 // ----------------------------------------------------------------------------
435 void TCollection_AsciiString::Center(const Standard_Integer Width ,
436 const Standard_Character Filler)
438 if(Width > mylength) {
439 Standard_Integer newlength = mylength + ((Width - mylength)/2);
440 LeftJustify(newlength,Filler);
441 RightJustify(Width,Filler);
443 else if (Width < 0) {
444 Standard_NegativeValue::Raise();
448 // ----------------------------------------------------------------------------
450 // ----------------------------------------------------------------------------
451 void TCollection_AsciiString::ChangeAll(const Standard_Character aChar,
452 const Standard_Character NewChar,
453 const Standard_Boolean CaseSensitive)
456 for (int i=0; i < mylength; i++)
457 if (mystring[i] == aChar) mystring[i] = NewChar;
460 Standard_Character anUpperChar = ::UpperCase(aChar);
461 for (int i=0; i < mylength; i++)
462 if (::UpperCase(mystring[i]) == anUpperChar) mystring[i] = NewChar;
466 // ----------------------------------------------------------------------------
468 // ----------------------------------------------------------------------------
469 void TCollection_AsciiString::Clear()
471 if (mystring) Standard::Free((void*&)mystring);
473 mystring = Allocate(mylength+1);
474 mystring[mylength] = '\0';
477 // ----------------------------------------------------------------------------
479 // ----------------------------------------------------------------------------
480 void TCollection_AsciiString::Copy(const Standard_CString fromwhere)
484 Standard_Integer newlength;
486 STRINGLEN( fromwhere , newlength ) ;
488 STRLEN(fromwhere,newlength);
492 mystring = Reallocate((void*&)mystring,
493 ROUNDMEM(newlength+1));
497 mystring = Allocate( ROUNDMEM(newlength + 1) );
500 CSTRINGCOPY( mystring , fromwhere , newlength ) ;
501 mylength = newlength;
503 STRCPY(mystring, fromwhere,newlength);
504 mystring[newlength] = '\0';
505 mylength = newlength;
511 mystring[mylength] = '\0';
516 // ----------------------------------------------------------------------------
518 // ----------------------------------------------------------------------------
519 void TCollection_AsciiString::Copy(const TCollection_AsciiString& fromwhere)
522 if (fromwhere.mystring) {
523 Standard_Integer newlength = fromwhere.mylength;
526 mystring = Reallocate((void*&)mystring,
527 ROUNDMEM(newlength+1));
531 mystring =Allocate(ROUNDMEM(newlength+1));
534 ASCIISTRINGCOPY( mystring , fromwhere.mystring , newlength ) ;
535 mylength = newlength;
537 STRCPY(mystring, fromwhere.mystring,newlength);
538 mylength = newlength;
539 mystring[mylength] = '\0';
545 mystring[mylength] = '\0';
551 // ----------------------------------------------------------------------------
553 // ----------------------------------------------------------------------------
554 void TCollection_AsciiString::Destroy()
556 if (mystring) Standard::Free((void*&)mystring);
560 // ----------------------------------------------------------------------------
561 // FirstLocationInSet
562 // ----------------------------------------------------------------------------
563 Standard_Integer TCollection_AsciiString::FirstLocationInSet
564 (const TCollection_AsciiString& Set,
565 const Standard_Integer FromIndex,
566 const Standard_Integer ToIndex) const
568 if (mylength == 0 || Set.mylength == 0) return 0;
569 if (FromIndex > 0 && ToIndex <= mylength && FromIndex <= ToIndex ) {
570 for(int i = FromIndex-1 ; i < ToIndex; i++)
571 for(int j = 0; j < Set.mylength; j++)
572 if (mystring[i] == Set.mystring[j]) return i+1;
575 Standard_OutOfRange::Raise();
579 // ----------------------------------------------------------------------------
580 // FirstLocationNotInSet
581 // ----------------------------------------------------------------------------
582 Standard_Integer TCollection_AsciiString::FirstLocationNotInSet
583 (const TCollection_AsciiString& Set,
584 const Standard_Integer FromIndex,
585 const Standard_Integer ToIndex) const
587 if (mylength == 0 || Set.mylength == 0) return 0;
588 if (FromIndex > 0 && ToIndex <= mylength && FromIndex <= ToIndex ) {
589 Standard_Boolean find;
590 for (int i = FromIndex-1 ; i < ToIndex; i++) {
591 find = Standard_False;
592 for(int j = 0; j < Set.mylength; j++)
593 if (mystring[i] == Set.mystring[j]) find = Standard_True;
594 if (!find) return i+1;
598 Standard_OutOfRange::Raise();
602 //----------------------------------------------------------------------------
603 // Insert a character before 'where'th character
604 // ----------------------------------------------------------------------------
605 void TCollection_AsciiString::Insert(const Standard_Integer where,
606 const Standard_Character what)
608 if (where > mylength + 1 ) Standard_OutOfRange::Raise
609 ("TCollection_AsciiString::Insert : Parameter where is too big");
610 if (where < 0) Standard_OutOfRange::Raise
611 ("TCollection_AsciiString::Insert : Parameter where is negative");
614 // Standard_Integer length = *(int*)((long)mystring-8);
615 // if((mylength+1) >> 4 > length-1 >> 4)
616 mystring = Reallocate((void*&)mystring,
620 mystring = Allocate(mylength+2);
622 if (where != mylength +1) {
623 for (int i=mylength-1; i >= where-1; i--)
624 mystring[i+1] = mystring[i];
626 mystring[where-1] = what;
628 mystring[mylength] = '\0';
631 // ----------------------------------------------------------------------------
633 // ----------------------------------------------------------------------------
634 void TCollection_AsciiString::Insert(const Standard_Integer where,
635 const Standard_CString what)
637 if (where <= mylength + 1) {
639 Standard_Integer whatlength;
641 STRINGLEN( what , whatlength );
643 STRLEN(what,whatlength);
645 Standard_Integer newlength = mylength + whatlength;
648 // Standard_Integer length = *(int*)((long)mystring-8);
649 // if(newlength >> 4 > length-1 >> 4)
650 mystring = Reallocate((void*&)mystring,
654 mystring =Allocate(newlength+1);
656 if (where != mylength +1) {
657 for (int i=mylength-1; i >= where-1; i--)
658 mystring[i+whatlength] = mystring[i];
660 for (int i=0; i < whatlength; i++)
661 mystring[where-1+i] = what[i];
663 mylength = newlength;
664 mystring[mylength] = '\0';
668 Standard_OutOfRange::Raise("TCollection_AsciiString::Insert : "
669 "Parameter where is too big");
673 // ----------------------------------------------------------------------------
675 // ----------------------------------------------------------------------------
676 void TCollection_AsciiString::Insert(const Standard_Integer where,
677 const TCollection_AsciiString& what)
679 Standard_CString swhat = what.mystring;
680 if (where <= mylength + 1) {
681 Standard_Integer whatlength = what.mylength;
683 Standard_Integer newlength = mylength + whatlength;
686 // Standard_Integer length = *(int*)((long)mystring-8);
687 // if(newlength >> 4 > length-1 >> 4)
688 mystring = Reallocate((void*&)mystring,
692 mystring =Allocate(newlength+1);
694 if (where != mylength +1) {
695 for (int i=mylength-1; i >= where-1; i--)
696 mystring[i+whatlength] = mystring[i];
698 for (int i=0; i < whatlength; i++)
699 mystring[where-1+i] = swhat[i];
701 mylength = newlength;
702 mystring[mylength] = '\0';
706 Standard_OutOfRange::Raise("TCollection_AsciiString::Insert : "
707 "Parameter where is too big");
711 //------------------------------------------------------------------------
713 //------------------------------------------------------------------------
714 void TCollection_AsciiString::InsertAfter(const Standard_Integer Index,
715 const TCollection_AsciiString& what)
717 if (Index < 0 || Index > mylength) Standard_OutOfRange::Raise();
718 Insert(Index+1,what);
721 //------------------------------------------------------------------------
723 //------------------------------------------------------------------------
724 void TCollection_AsciiString::InsertBefore(const Standard_Integer Index,
725 const TCollection_AsciiString& what)
727 if (Index < 1 || Index > mylength) Standard_OutOfRange::Raise();
731 // ----------------------------------------------------------------------------
733 // ----------------------------------------------------------------------------
734 Standard_Boolean TCollection_AsciiString::IsEqual
735 (const Standard_CString other)const
741 // STRINGLEN( other , otherlength );
743 STRLEN(other,otherlength);
744 if(mylength != otherlength) return Standard_False;
747 Standard_Boolean KEqual ;
748 // CSTRINGEQUAL( mystring , other , mylength , KEqual ) ;
750 LCSTRINGEQUAL( mystring , mylength , other , KEqual ) ;
754 STRINGLEN( other , otherlength );
755 if ( mylength != otherlength )
756 return Standard_False ;
757 return Standard_True;
759 for (int i = 0 ; i < mylength ; i++)
760 if (mystring[i] != other[i]) return Standard_False;
761 return Standard_True;
764 Standard_NullObject::Raise("TCollection_AsciiString::Operator == "
765 "Parameter 'other'");
766 return Standard_False;
769 // ----------------------------------------------------------------------------
771 // ----------------------------------------------------------------------------
772 Standard_Boolean TCollection_AsciiString::IsEqual
773 (const TCollection_AsciiString& other)const
776 if (mylength != other.mylength) return Standard_False;
778 Standard_Boolean KEqual ;
779 ASCIISTRINGEQUAL( mystring , other.mystring , mylength , KEqual ) ;
782 Standard_CString sother = other.mystring;
783 for (int i = 0 ; i < mylength ; i++)
784 if (mystring[i] != sother[i]) return Standard_False;
785 return Standard_True;
789 // ----------------------------------------------------------------------------
791 // ----------------------------------------------------------------------------
792 Standard_Boolean TCollection_AsciiString::IsEmpty() const
794 return (mylength == 0);
797 // ----------------------------------------------------------------------------
799 // ----------------------------------------------------------------------------
800 Standard_Boolean TCollection_AsciiString::IsDifferent
801 (const Standard_CString other)const
805 // STRINGLEN( other , otherlength );
807 STRLEN(other,otherlength);
808 if(mylength != otherlength) return Standard_True;
811 Standard_Boolean KEqual ;
812 // CSTRINGEQUAL( mystring , other , mylength , KEqual ) ;
814 LCSTRINGEQUAL( mystring , mylength , other , KEqual ) ;
817 // STRINGLEN( other , otherlength );
818 return Standard_True;
823 for (int i = 0 ; i < mylength ; i++)
824 if (mystring[i] != other[i]) return Standard_True;
825 return Standard_False;
826 if ( mylength != otherlength )
827 return Standard_False ;
828 return Standard_True;
831 Standard_NullObject::Raise("TCollection_AsciiString::Operator != "
832 "Parameter 'other'");
833 return Standard_False;
836 // ----------------------------------------------------------------------------
838 // ----------------------------------------------------------------------------
839 Standard_Boolean TCollection_AsciiString::IsDifferent
840 (const TCollection_AsciiString& other)const
843 if (mylength != other.mylength) return Standard_True;
845 Standard_Boolean KEqual ;
846 ASCIISTRINGEQUAL( mystring , other.mystring , mylength , KEqual ) ;
849 Standard_CString sother = other.mystring;
850 for (int i = 0 ; i < mylength ; i++)
851 if (mystring[i] != sother[i]) return Standard_True;
852 return Standard_False;
856 // ----------------------------------------------------------------------------
858 // ----------------------------------------------------------------------------
859 Standard_Boolean TCollection_AsciiString::IsLess
860 (const Standard_CString other)const
865 Standard_Boolean KLess ;
867 // STRINGLEN( other , otherlength );
868 // CSTRINGLESS( mystring , mylength , other , otherlength ,
869 // INF( mylength , otherlength ) , KLess ) ;
870 LCSTRINGLESS( mystring , mylength , other , KLess ) ;
873 Standard_Integer otherlength;
874 Standard_Integer i = 0, j = 0;
875 STRLEN(other,otherlength);
876 while ( i < mylength && j < otherlength) {
877 if (mystring[i] < other[j]) return Standard_True;
878 if (mystring[i] > other[j]) return Standard_False;
882 if (i == mylength && j < otherlength) return Standard_True;
883 return Standard_False;
886 Standard_NullObject::Raise("TCollection_AsciiString::Operator < "
887 "Parameter 'other'");
888 return Standard_False;
891 // ----------------------------------------------------------------------------
893 // ----------------------------------------------------------------------------
894 Standard_Boolean TCollection_AsciiString::IsLess
895 (const TCollection_AsciiString& other)const
899 Standard_Boolean KLess ;
900 ASCIISTRINGLESS( mystring , mylength , other.mystring , other.mylength ,
901 INF( mylength , other.mylength ) , KLess ) ;
905 Standard_Integer i = 0, j = 0;
906 Standard_Integer otherlength = other.mylength;
907 Standard_CString sother = other.mystring;
908 while ( i < mylength && j < otherlength) {
909 if (mystring[i] < sother[j]) return Standard_True;
910 if (mystring[i] > sother[j]) return Standard_False;
914 if (i == mylength && j < otherlength) return Standard_True;
915 return Standard_False;
919 // ----------------------------------------------------------------------------
921 // ----------------------------------------------------------------------------
922 Standard_Boolean TCollection_AsciiString::IsGreater
923 (const Standard_CString other)const
928 Standard_Boolean KGreater ;
930 // STRINGLEN( other , otherlength );
931 // CSTRINGGREATER( mystring , mylength , other , otherlength ,
932 // INF( mylength , otherlength ) , KGreater ) ;
933 LCSTRINGGREATER( mystring , mylength , other , KGreater ) ;
936 Standard_Integer otherlength;
937 Standard_Integer i = 0, j = 0;
938 STRLEN(other,otherlength);
939 while (i < mylength && j <= otherlength) {
940 if (mystring[i] < other[j]) return Standard_False;
941 if (mystring[i] > other[j]) return Standard_True;
945 if (j == otherlength && i < mylength) return Standard_True;
946 return Standard_False;
949 Standard_NullObject::Raise("TCollection_AsciiString::Operator > "
950 "Parameter 'other'");
951 return Standard_False;
954 // ----------------------------------------------------------------------------
956 // ----------------------------------------------------------------------------
957 Standard_Boolean TCollection_AsciiString::IsGreater
958 (const TCollection_AsciiString& other)const
962 Standard_Boolean KGreater ;
964 ASCIISTRINGGREATER( mystring , mylength , other.mystring , other.mylength,
965 INF( mylength , other.mylength ) , KGreater ) ;
968 Standard_Integer i = 0, j = 0;
969 Standard_Integer otherlength = other.mylength;
970 Standard_CString sother = other.mystring;
971 while (i < mylength && j <= otherlength) {
972 if (mystring[i] < sother[j]) return Standard_False;
973 if (mystring[i] > sother[j]) return Standard_True;
977 if (j == otherlength && i < mylength) return Standard_True;
978 return Standard_False;
982 // ----------------------------------------------------------------------------
984 // ----------------------------------------------------------------------------
985 Standard_Integer TCollection_AsciiString::IntegerValue()const
988 Standard_Integer value = 0;
990 value = (int)strtol(mystring,&ptr,10);
991 if (ptr != mystring) return value;
993 Standard_NumericError::Raise("TCollection_AsciiString::IntegerValue");
997 // ----------------------------------------------------------------------------
999 // ----------------------------------------------------------------------------
1000 Standard_Boolean TCollection_AsciiString::IsIntegerValue()const
1005 // Standard_Integer value = (int)strtol(mystring,&ptr,10);
1007 strtol(mystring,&ptr,10);
1009 if (ptr != mystring) {
1010 for (int i=0; i < mylength; i++) {
1011 if (mystring[i] == '.') return Standard_False;
1013 return Standard_True;
1016 return Standard_False;
1019 // ----------------------------------------------------------------------------
1021 // ----------------------------------------------------------------------------
1022 Standard_Boolean TCollection_AsciiString::IsRealValue()const
1026 Strtod(mystring,&ptr);
1027 if (ptr != mystring) return Standard_True;
1028 else return Standard_False;
1030 return Standard_False;
1033 // ----------------------------------------------------------------------------
1035 // ----------------------------------------------------------------------------
1036 Standard_Boolean TCollection_AsciiString::IsAscii()const
1038 // LD : Debuggee le 26/11/98
1039 // Cette fonction retournait TOUJOURS Standard_True !
1040 for (int i=0; i < mylength; i++)
1041 if (mystring[i] >= 127 || mystring[i] < ' ') return Standard_False;
1042 return Standard_True;
1045 //------------------------------------------------------------------------
1047 //------------------------------------------------------------------------
1048 void TCollection_AsciiString::LeftAdjust ()
1050 Standard_Integer i ;
1051 for( i = 0 ; i < mylength ; i ++) if(!IsSpace(mystring[i])) break;
1052 if( i > 0 ) Remove(1,i);
1055 //------------------------------------------------------------------------
1057 //------------------------------------------------------------------------
1058 void TCollection_AsciiString::LeftJustify(const Standard_Integer Width,
1059 const Standard_Character Filler)
1061 if (Width > mylength) {
1063 // Standard_Integer length = *(int*)((long)mystring-8);
1064 // if(Width >> 4 > length-1 >> 4)
1065 mystring = Reallocate((void*&)mystring,
1069 mystring = Allocate(Width+1);
1071 for (int i = mylength; i < Width ; i++) mystring[i] = Filler;
1073 mystring[mylength] = '\0';
1075 else if (Width < 0) {
1076 Standard_NegativeValue::Raise();
1080 //------------------------------------------------------------------------
1082 //------------------------------------------------------------------------
1083 Standard_Integer TCollection_AsciiString::Location
1084 (const Standard_Integer N ,
1085 const Standard_Character C ,
1086 const Standard_Integer FromIndex,
1087 const Standard_Integer ToIndex ) const
1089 if (FromIndex > 0 && ToIndex <= mylength && FromIndex <= ToIndex ) {
1090 for(int i = FromIndex-1, count = 0; i <= ToIndex-1; i++) {
1091 if(mystring[i] == C) {
1093 if ( count == N ) return i+1;
1098 Standard_OutOfRange::Raise();
1102 //------------------------------------------------------------------------
1104 //------------------------------------------------------------------------
1105 Standard_Integer TCollection_AsciiString::Location
1106 (const TCollection_AsciiString& what,
1107 const Standard_Integer FromIndex,
1108 const Standard_Integer ToIndex) const
1110 if (mylength == 0 || what.mylength == 0) return 0;
1111 if (ToIndex <= mylength && FromIndex > 0 && FromIndex <= ToIndex ) {
1112 Standard_Integer i = FromIndex-1;
1113 Standard_Integer k = 1;
1114 Standard_Integer l = FromIndex-2;
1115 Standard_Boolean Find = Standard_False;
1116 while (!Find && i < ToIndex) {
1117 if (mystring[i] == what.Value(k)) {
1119 if ( k > what.mylength) Find = Standard_True;
1122 if (k > 1) i--; // si on est en cours de recherche
1128 if (Find) return l+2;
1131 Standard_OutOfRange::Raise();
1135 // ----------------------------------------------------------------------------
1137 // ----------------------------------------------------------------------------
1138 void TCollection_AsciiString::LowerCase()
1140 for (int i=0; i < mylength; i++)
1141 mystring[i] = ::LowerCase(mystring[i]);
1144 //------------------------------------------------------------------------
1146 //------------------------------------------------------------------------
1147 void TCollection_AsciiString::Prepend(const TCollection_AsciiString& what)
1152 // ----------------------------------------------------------------------------
1154 // ----------------------------------------------------------------------------
1155 Standard_Real TCollection_AsciiString::RealValue()const
1158 Standard_Real value = 0;
1160 value = Strtod(mystring,&ptr);
1161 if (ptr != mystring) return value;
1163 Standard_NumericError::Raise("TCollection_AsciiString::RealValue");
1167 // ----------------------------------------------------------------------------
1169 //--------------------------------------------------------------------------
1170 void TCollection_AsciiString::Read(Standard_IStream& astream)
1176 Standard_Character buffer[8190]; } CHN ;
1177 astream >> CHN.buffer; // Get characters from astream
1180 STRINGLEN( CHN.buffer , newlength );
1182 STRLEN(CHN.buffer,newlength);
1185 // Standard_Integer length = *(int*)((long)mystring-8);
1186 // if(newlength >> 4 > length-1 >> 4)
1187 mystring = Reallocate((void*&)mystring,
1188 ROUNDMEM(newlength+1));
1191 mystring =Allocate(ROUNDMEM(newlength+1));
1194 ASCIISTRINGCOPY( mystring , CHN.buffer , newlength ) ;
1195 mylength = newlength;
1197 STRCPY(mystring,CHN.buffer,newlength);
1198 mylength = newlength;
1199 mystring[mylength] = '\0';
1204 //---------------------------------------------------------------------------
1205 Standard_IStream& operator >> (Standard_IStream& astream,
1206 TCollection_AsciiString& astring)
1208 astring.Read(astream);
1213 // ----------------------------------------------------------------------------
1215 // ----------------------------------------------------------------------------
1216 void TCollection_AsciiString::Print(Standard_OStream& astream)const
1218 if(mystring) astream << mystring;
1222 // ----------------------------------------------------------------------------
1223 Standard_OStream& operator << (Standard_OStream& astream,
1224 const TCollection_AsciiString& astring)
1226 astring.Print(astream);
1230 // ----------------------------------------------------------------------------
1232 // ----------------------------------------------------------------------------
1233 void TCollection_AsciiString::RemoveAll(const Standard_Character what,
1234 const Standard_Boolean CaseSensitive)
1236 if (mylength == 0) return;
1238 if (CaseSensitive) {
1239 for (int i=0; i < mylength; i++)
1240 if (mystring[i] != what) mystring[c++] = mystring[i];
1243 Standard_Character upperwhat = ::UpperCase(what);
1244 for (int i=0; i < mylength; i++) {
1245 if (::UpperCase(mystring[i]) != upperwhat) mystring[c++] = mystring[i];
1249 mystring[mylength] = '\0';
1252 // ----------------------------------------------------------------------------
1254 // ----------------------------------------------------------------------------
1255 void TCollection_AsciiString::RemoveAll(const Standard_Character what)
1257 if (mylength == 0) return;
1259 for (int i=0; i < mylength; i++)
1260 if (mystring[i] != what) mystring[c++] = mystring[i];
1262 mystring[mylength] = '\0';
1265 // ----------------------------------------------------------------------------
1267 // ----------------------------------------------------------------------------
1268 void TCollection_AsciiString::Remove (const Standard_Integer where,
1269 const Standard_Integer ahowmany)
1271 if (where+ahowmany <= mylength+1) {
1273 for(i = where+ahowmany-1, j = where-1; i < mylength; i++, j++)
1274 mystring[j] = mystring[i];
1275 mylength -= ahowmany;
1276 mystring[mylength] = '\0';
1279 Standard_OutOfRange::Raise("TCollection_AsciiString::Remove: "
1280 "Too many characters to erase or invalid "
1285 //------------------------------------------------------------------------
1287 //------------------------------------------------------------------------
1288 void TCollection_AsciiString::RightAdjust ()
1290 Standard_Integer i ;
1291 for ( i = mylength-1 ; i >= 0 ; i--)
1292 if(!IsSpace(mystring[i]))
1294 if( i < mylength-1 )
1295 Remove(i+2,mylength-(i+2)+1);
1298 //------------------------------------------------------------------------
1300 //------------------------------------------------------------------------
1301 void TCollection_AsciiString::RightJustify(const Standard_Integer Width,
1302 const Standard_Character Filler)
1304 Standard_Integer i ;
1305 Standard_Integer k ;
1306 if (Width > mylength) {
1308 // Standard_Integer length = *(int*)((long)mystring-8);
1309 // if(Width >> 4 > length-1 >> 4)
1310 mystring = Reallocate((void*&)mystring,
1314 mystring =Allocate(Width+1);
1316 for ( i = mylength-1, k = Width-1 ; i >= 0 ; i--, k--)
1317 mystring[k] = mystring[i];
1318 for(; k >= 0 ; k--) mystring[k] = Filler;
1320 mystring[mylength] = '\0';
1322 else if (Width < 0) {
1323 Standard_NegativeValue::Raise();
1327 // ----------------------------------------------------------------------------
1329 // ----------------------------------------------------------------------------
1330 Standard_Integer TCollection_AsciiString::Search
1331 (const Standard_CString what)const
1333 Standard_Integer size;
1335 STRINGLEN( what , size );
1342 while ( i < mylength-size+1 ) {
1345 while (j < size && mystring[k++] == what[j++])
1346 if (j == size) return i;
1353 // ----------------------------------------------------------------------------
1355 // ----------------------------------------------------------------------------
1356 Standard_Integer TCollection_AsciiString::Search
1357 (const TCollection_AsciiString& what) const
1359 Standard_Integer size = what.mylength;
1360 Standard_CString swhat = what.mystring;
1364 Standard_Boolean find = Standard_False;
1365 while ( i < mylength-size+1 && !find) {
1368 while (j < size && mystring[k++] == swhat[j++])
1369 if (j == size) find = Standard_True;
1377 // ----------------------------------------------------------------------------
1379 // ----------------------------------------------------------------------------
1380 Standard_Integer TCollection_AsciiString::SearchFromEnd
1381 (const Standard_CString what)const
1385 STRINGLEN( what , size );
1392 Standard_Boolean find = Standard_False;
1393 while ( i >= size-1 && !find) {
1396 while (j >= 0 && mystring[k--] == what[j--])
1397 if (j == -1) find = Standard_True;
1399 if (find) return i-size+3;
1405 // ----------------------------------------------------------------------------
1407 // ----------------------------------------------------------------------------
1408 Standard_Integer TCollection_AsciiString::SearchFromEnd
1409 (const TCollection_AsciiString& what)const
1411 int size = what.mylength;
1413 Standard_CString swhat = what.mystring;
1416 Standard_Boolean find = Standard_False;
1417 while ( i >= size-1 && !find) {
1420 while (j >= 0 && mystring[k--] == swhat[j--])
1421 if (j == -1) find = Standard_True;
1423 if (find) return i-size+3;
1428 // ----------------------------------------------------------------------------
1430 // ----------------------------------------------------------------------------
1431 void TCollection_AsciiString::SetValue(const Standard_Integer where,
1432 const Standard_Character what)
1434 if (where > 0 && where <= mylength) {
1435 mystring[where-1] = what;
1438 Standard_OutOfRange::Raise("TCollection_AsciiString::SetValue : "
1443 // ----------------------------------------------------------------------------
1445 // ----------------------------------------------------------------------------
1446 void TCollection_AsciiString::SetValue(const Standard_Integer where,
1447 const Standard_CString what)
1449 if (where > 0 && where <= mylength+1) {
1450 Standard_Integer size;
1452 STRINGLEN( what , size );
1456 size += (where - 1);
1457 if (size >= mylength){
1459 // Standard_Integer length = *(int*)((long)mystring-8);
1460 // if(size >> 4 > length-1 >> 4)
1461 mystring = Reallocate((void*&)mystring,
1465 mystring =Allocate(size+1);
1469 for (int i = where-1; i < size; i++)
1470 mystring[i] = what[i-(where-1)];
1471 mystring[mylength] = '\0';
1474 Standard_OutOfRange::Raise("TCollection_AsciiString::SetValue : "
1479 // ----------------------------------------------------------------------------
1481 // ----------------------------------------------------------------------------
1482 void TCollection_AsciiString::SetValue(const Standard_Integer where,
1483 const TCollection_AsciiString& what)
1485 if (where > 0 && where <= mylength+1) {
1486 Standard_Integer size = what.mylength;
1487 Standard_CString swhat = what.mystring;
1488 size += (where - 1);
1489 if (size >= mylength){
1491 // Standard_Integer length = *(int*)((long)mystring-8);
1492 // if(size >> 4 > length-1 >> 4)
1493 mystring = Reallocate((void*&)mystring,
1497 mystring =Allocate(size+1);
1501 for (int i = where-1; i < size; i++)
1502 mystring[i] = swhat[i-(where-1)];
1503 mystring[mylength] = '\0';
1506 Standard_OutOfRange::Raise("TCollection_AsciiString::SetValue : "
1511 // ----------------------------------------------------------------------------
1514 // ----------------------------------------------------------------------------
1515 void TCollection_AsciiString::Split(const Standard_Integer where,
1516 TCollection_AsciiString& res)
1518 if (where >= 0 && where <= mylength) {
1519 res = &mystring[where] ;
1523 Standard_OutOfRange::Raise("TCollection_AsciiString::Split index");
1527 // ----------------------------------------------------------------------------
1529 // ----------------------------------------------------------------------------
1530 TCollection_AsciiString TCollection_AsciiString::Split
1531 (const Standard_Integer where)
1533 if (where >= 0 && where <= mylength) {
1535 TCollection_AsciiString res( &mystring[where] , mylength - where );
1537 TCollection_AsciiString res(&mystring[where]);
1542 Standard_OutOfRange::Raise("TCollection_AsciiString::Split index");
1543 TCollection_AsciiString res;
1547 // ----------------------------------------------------------------------------
1550 // ----------------------------------------------------------------------------
1551 void TCollection_AsciiString::SubString(const Standard_Integer FromIndex,
1552 const Standard_Integer ToIndex,
1553 TCollection_AsciiString& res) const
1556 if (ToIndex > mylength || FromIndex <= 0 || FromIndex > ToIndex )
1557 Standard_OutOfRange::Raise();
1558 Standard_Integer newlength = ToIndex-FromIndex+1;
1559 res.mystring =Allocate(ROUNDMEM(newlength+1));
1562 CSTRINGCOPY( res.mystring , &(mystring [ FromIndex - 1 ]) , newlength );
1564 memcpy(res.mystring, &(mystring[FromIndex-1]),newlength);
1566 res.mystring[newlength] = '\0';
1567 res.mylength = newlength;
1572 // ----------------------------------------------------------------------------
1574 // ----------------------------------------------------------------------------
1575 TCollection_AsciiString TCollection_AsciiString::SubString
1576 (const Standard_Integer FromIndex,
1577 const Standard_Integer ToIndex) const
1580 if (ToIndex > mylength || FromIndex <= 0 || FromIndex > ToIndex )
1581 Standard_OutOfRange::Raise();
1584 return TCollection_AsciiString( &mystring [ FromIndex - 1 ] ,
1585 ToIndex - FromIndex + 1 ) ;
1588 TCollection_AsciiString res;
1589 Standard_Integer newlength = ToIndex-FromIndex+1;
1590 res.mystring = Allocate(ROUNDMEM(newlength+1));
1592 CSTRINGCOPY( res.mystring , &(mystring [ FromIndex - 1 ]) , newlength );
1594 memcpy(res.mystring, &(mystring[FromIndex-1]),newlength);
1596 res.mystring[newlength] = '\0';
1597 res.mylength = newlength;
1603 // ----------------------------------------------------------------------------
1606 // ----------------------------------------------------------------------------
1607 void TCollection_AsciiString::Token(const Standard_CString separators,
1608 const Standard_Integer whichone,
1609 TCollection_AsciiString& res)const
1613 res = Token( separators , whichone ) ;
1617 Standard_NullObject::Raise("TCollection_AsciiString::Token : "
1618 "parameter 'separators'");
1621 Standard_CString buftmp =Allocate(mylength+1);
1622 Standard_Character aSep;
1624 Standard_Boolean isSepFound = Standard_False, otherSepFound;
1628 for (i = 0; i < whichone && j < mylength; i++) {
1629 isSepFound = Standard_False;
1633 // Avant de commencer il faut virer les saloperies devant
1635 otherSepFound = Standard_True;
1636 while (j < mylength && otherSepFound) {
1638 otherSepFound = Standard_False;
1639 aSep = separators[l];
1641 if (aSep == mystring[j]) {
1643 otherSepFound = Standard_True;
1646 aSep = separators[l++];
1649 if (otherSepFound) j++;
1652 while (!isSepFound && k < mylength && j<mylength ) {
1654 aSep = separators[l];
1656 while (aSep != 0 && !isSepFound) {
1657 if (aSep == mystring[j]) {
1659 isSepFound = Standard_True;
1662 buftmp[k] = mystring[j];
1665 aSep = separators[l];
1668 if(j==mylength) buftmp[k] = 0;
1674 Standard::Free((void*&)buftmp);
1677 res.mystring = buftmp;
1679 STRINGLEN( buftmp , res.mylength );
1681 STRLEN(buftmp,res.mylength);
1688 // ----------------------------------------------------------------------------
1690 // ----------------------------------------------------------------------------
1691 TCollection_AsciiString TCollection_AsciiString::Token
1692 (const Standard_CString separators,
1693 const Standard_Integer whichone) const
1696 Standard_NullObject::Raise("TCollection_AsciiString::Token : "
1697 "parameter 'separators'");
1700 Standard_Integer theOne ;
1701 Standard_Integer StringIndex = 0 ;
1702 Standard_Integer SeparatorIndex ;
1703 Standard_Integer BeginIndex=0 ;
1704 Standard_Integer EndIndex=0 ;
1706 // cout << "'" << mystring << "'" << endl ;
1707 for ( theOne = 0 ; theOne < whichone ; theOne++ ) {
1710 // cout << "theOne " << theOne << endl ;
1711 if ( StringIndex == mylength )
1713 for (; StringIndex < mylength && EndIndex == 0 ; StringIndex++ ) {
1714 SeparatorIndex = 0 ;
1715 // cout << "StringIndex " << StringIndex << endl ;
1716 while ( separators [ SeparatorIndex ] ) {
1717 if ( mystring [ StringIndex ] == separators [ SeparatorIndex ] ) {
1720 SeparatorIndex += 1 ;
1722 if ( separators [ SeparatorIndex ] != '\0' ) { // We have a Separator
1723 if ( BeginIndex && EndIndex == 0 ) {
1724 EndIndex = StringIndex ;
1725 // cout << "EndIndex " << EndIndex << " '" << SubString( BeginIndex , EndIndex ).ToCString() << "'" << endl ;
1729 else if ( BeginIndex == 0 ) { // We have not a Separator
1730 BeginIndex = StringIndex + 1 ;
1731 // cout << "BeginIndex " << BeginIndex << endl ;
1734 // cout << "BeginIndex " << BeginIndex << " EndIndex " << EndIndex << endl ;
1736 if ( BeginIndex == 0 )
1737 return TCollection_AsciiString("",0) ;
1738 if ( EndIndex == 0 )
1739 EndIndex = mylength ;
1740 // cout << "'" << SubString( BeginIndex , EndIndex ).ToCString() << "'" << endl ;
1741 return TCollection_AsciiString( &mystring [ BeginIndex - 1 ] ,
1742 EndIndex - BeginIndex + 1 ) ;
1744 // Hereafter : Why write simple when we can write complicated ! ...
1746 TCollection_AsciiString res;
1749 Standard_CString buftmp = Allocate(mylength+1);
1750 Standard_Character aSep;
1752 Standard_Boolean isSepFound = Standard_False, otherSepFound;
1756 for (i = 0; i < whichone && j < mylength; i++) {
1757 isSepFound = Standard_False;
1761 // Avant de commencer il faut virer les saloperies devant
1763 otherSepFound = Standard_True;
1764 while (j < mylength && otherSepFound) {
1766 otherSepFound = Standard_False;
1767 aSep = separators[l];
1769 if (aSep == mystring[j]) {
1771 otherSepFound = Standard_True;
1774 aSep = separators[l++];
1777 if (otherSepFound) j++;
1780 while (!isSepFound && k < mylength && j<mylength ) {
1782 aSep = separators[l];
1784 while (aSep != 0 && !isSepFound) {
1785 if (aSep == mystring[j]) {
1787 isSepFound = Standard_True;
1790 buftmp[k] = mystring[j];
1793 aSep = separators[l];
1796 if(j==mylength) buftmp[k] = 0;
1802 Standard::Free((void*&)buftmp);
1805 res.mystring = buftmp;
1807 STRINGLEN( buftmp , res.mylength );
1809 STRLEN(buftmp,res.mylength);
1816 // ----------------------------------------------------------------------------
1818 // ----------------------------------------------------------------------------
1819 void TCollection_AsciiString::Trunc(const Standard_Integer ahowmany)
1821 if (ahowmany < 0 || ahowmany > mylength)
1822 Standard_OutOfRange::Raise("TCollection_AsciiString::Trunc : "
1823 "parameter 'ahowmany'");
1824 mylength = ahowmany;
1825 mystring[mylength] = '\0';
1828 // ----------------------------------------------------------------------------
1830 // ----------------------------------------------------------------------------
1831 void TCollection_AsciiString::UpperCase()
1833 for (int i=0; i < mylength; i++)
1834 mystring[i] = ::UpperCase(mystring[i]);
1837 //------------------------------------------------------------------------
1839 //------------------------------------------------------------------------
1840 Standard_Integer TCollection_AsciiString::UsefullLength () const
1842 Standard_Integer i ;
1843 for ( i = mylength -1 ; i >= 0 ; i--)
1844 if (IsGraphic(mystring[i])) break;
1848 // ----------------------------------------------------------------------------
1850 // ----------------------------------------------------------------------------
1851 Standard_Character TCollection_AsciiString::Value
1852 (const Standard_Integer where)const
1854 if (where > 0 && where <= mylength) {
1855 if(mystring) return mystring[where-1];
1858 Standard_OutOfRange::Raise("TCollection_AsciiString::Value : parameter where");
1863 //------------------------------------------------------------------------
1865 //------------------------------------------------------------------------
1866 Standard_Boolean TCollection_AsciiString::ISSIMILAR
1867 (const TCollection_AsciiString& string1,
1868 const TCollection_AsciiString& string2)
1870 if ( string1.Length() != string2.Length() )
1871 return Standard_False ;
1872 return ::ISSIMILAR (string1.ToCString() ,
1874 string2.ToCString() );