1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0024002: Overall code and build procedure refactoring -- automatic

Automatic upgrade of OCCT code by command "occt_upgrade . -nocdl":
- WOK-generated header files from inc and sources from drv are moved to src
- CDL files removed
- All packages are converted to nocdlpack
This commit is contained in:
abv
2015-07-12 07:42:38 +03:00
parent 543a996496
commit 42cf5bc1ca
15354 changed files with 623957 additions and 509844 deletions

View File

@@ -1 +1,70 @@
TCollection_WOKSteps.edl
TCollection.cxx
TCollection.hxx
TCollection_Array1.gxx
TCollection_Array1.lxx
TCollection_Array2.gxx
TCollection_Array2.lxx
TCollection_AsciiString.cxx
TCollection_AsciiString.hxx
TCollection_AsciiString.lxx
TCollection_BaseSequence.cxx
TCollection_BaseSequence.hxx
TCollection_BaseSequence.lxx
TCollection_BasicMap.cxx
TCollection_BasicMap.hxx
TCollection_BasicMap.lxx
TCollection_BasicMapIterator.cxx
TCollection_BasicMapIterator.hxx
TCollection_BasicMapIterator.lxx
TCollection_DataMap.gxx
TCollection_DataMapIterator.gxx
TCollection_DataMapNode.gxx
TCollection_DataMapNode.lxx
TCollection_DoubleMap.gxx
TCollection_DoubleMapIterator.gxx
TCollection_DoubleMapNode.gxx
TCollection_DoubleMapNode.lxx
TCollection_ExtendedString.cxx
TCollection_ExtendedString.hxx
TCollection_ExtendedString.lxx
TCollection_HArray1.gxx
TCollection_HArray1.lxx
TCollection_HArray2.gxx
TCollection_HArray2.lxx
TCollection_HAsciiString.cxx
TCollection_HAsciiString.hxx
TCollection_HAsciiString.lxx
TCollection_HExtendedString.cxx
TCollection_HExtendedString.hxx
TCollection_HSequence.gxx
TCollection_HSequence.lxx
TCollection_IndexedDataMap.gxx
TCollection_IndexedDataMapNode.gxx
TCollection_IndexedDataMapNode.lxx
TCollection_IndexedMap.gxx
TCollection_IndexedMapNode.gxx
TCollection_IndexedMapNode.lxx
TCollection_List.gxx
TCollection_List.lxx
TCollection_ListIterator.gxx
TCollection_ListIterator.lxx
TCollection_ListNode.gxx
TCollection_ListNode.lxx
TCollection_Map.gxx
TCollection_MapHasher.gxx
TCollection_MapIterator.gxx
TCollection_MapNode.cxx
TCollection_MapNode.hxx
TCollection_MapNode.lxx
TCollection_MapNodePtr.hxx
TCollection_SeqNode.cxx
TCollection_SeqNode.hxx
TCollection_SeqNode.lxx
TCollection_SeqNodePtr.hxx
TCollection_Sequence.gxx
TCollection_Sequence.lxx
TCollection_SequenceNode.gxx
TCollection_SequenceNode.lxx
TCollection_Side.hxx
TCollection_StdMapNode.gxx
TCollection_StdMapNode.lxx

View File

@@ -1,96 +0,0 @@
-- Created on: 1992-10-13
-- Created by: Ramin BARRETO
-- Copyright (c) 1992-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- Updated J.P. TIRAULT, M. MERCIEN Nov,25 1992
-- Adding classes
-- - Array1
-- - Array2
-- Updated R.LEQUETTE Jan 1993
-- Adding of modifying classes
-- - Sequence, HSequence
-- - List
-- - BasicMap, BasicMapIterator
-- - Map, DataMap, DoubleMap, IndexedMap, IndexedDataMap
package TCollection
---Purpose: The package <TCollection> provides the services for the
-- transient basic data structures.
uses
Standard,
MMgt
is
class AsciiString;
class ExtendedString;
class HAsciiString;
class HExtendedString;
generic class Array1;
generic class HArray1;
generic class Array2;
generic class HArray2;
generic class List, ListNode, ListIterator;
class BaseSequence;
class SeqNode;
pointer SeqNodePtr to SeqNode from TCollection;
generic class Sequence,SequenceNode;
generic class HSequence;
generic class MapHasher;
private deferred class BasicMap;
private class MapNode;
pointer MapNodePtr to MapNode from TCollection;
private deferred class BasicMapIterator;
generic class Map, MapIterator,StdMapNode;
generic class DataMap, DataMapIterator,DataMapNode;
generic class DoubleMap, DoubleMapIterator, DoubleMapNode;
generic class IndexedMap,IndexedMapNode;
generic class IndexedDataMap,IndexedDataMapNode;
enumeration Side is Left , Right;
NextPrimeForMap(I : Integer) returns Integer;
---Purpose: Returns a prime number greater than <I> suitable
-- to dimension a Map. When <I> becomes great there
-- is a limit on the result (today the limit is
-- around 1 000 000). This is not a limit of the number of
-- items but a limit in the number of buckets. i.e.
-- there will be more collisions in the map.
end TCollection;

View File

@@ -14,7 +14,8 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TCollection.ixx>
#include <TCollection.hxx>
// The array of prime numbers used as consequtive steps for
// size of array of buckets in the map.
@@ -26,7 +27,6 @@
// memory overhead in that case is only ~15% as compared with total size of
// all auxiliary data structures (each map node takes ~24 bytes),
// and this proves to pay off in performance (see OCC13189).
#define NB_PRIMES 12
static const Standard_Integer Primes[NB_PRIMES+1] = {
101,

View File

@@ -0,0 +1,133 @@
// Created on: 1992-10-13
// Created by: Ramin BARRETO
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TCollection_HeaderFile
#define _TCollection_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
class TCollection_AsciiString;
class TCollection_ExtendedString;
class TCollection_HAsciiString;
class TCollection_HExtendedString;
class TCollection_Array1;
class TCollection_HArray1;
class TCollection_Array2;
class TCollection_HArray2;
class TCollection_List;
class TCollection_ListNode;
class TCollection_ListIterator;
class TCollection_BaseSequence;
class TCollection_SeqNode;
class TCollection_Sequence;
class TCollection_SequenceNode;
class TCollection_HSequence;
class TCollection_MapHasher;
class TCollection_BasicMap;
class TCollection_MapNode;
class TCollection_BasicMapIterator;
class TCollection_Map;
class TCollection_MapIterator;
class TCollection_StdMapNode;
class TCollection_DataMap;
class TCollection_DataMapIterator;
class TCollection_DataMapNode;
class TCollection_DoubleMap;
class TCollection_DoubleMapIterator;
class TCollection_DoubleMapNode;
class TCollection_IndexedMap;
class TCollection_IndexedMapNode;
class TCollection_IndexedDataMap;
class TCollection_IndexedDataMapNode;
//! The package <TCollection> provides the services for the
//! transient basic data structures.
class TCollection
{
public:
DEFINE_STANDARD_ALLOC
//! Returns a prime number greater than <I> suitable
//! to dimension a Map. When <I> becomes great there
//! is a limit on the result (today the limit is
//! around 1 000 000). This is not a limit of the number of
//! items but a limit in the number of buckets. i.e.
//! there will be more collisions in the map.
Standard_EXPORT static Standard_Integer NextPrimeForMap (const Standard_Integer I);
protected:
private:
friend class TCollection_AsciiString;
friend class TCollection_ExtendedString;
friend class TCollection_HAsciiString;
friend class TCollection_HExtendedString;
friend class TCollection_Array1;
friend class TCollection_HArray1;
friend class TCollection_Array2;
friend class TCollection_HArray2;
friend class TCollection_List;
friend class TCollection_ListNode;
friend class TCollection_ListIterator;
friend class TCollection_BaseSequence;
friend class TCollection_SeqNode;
friend class TCollection_Sequence;
friend class TCollection_SequenceNode;
friend class TCollection_HSequence;
friend class TCollection_MapHasher;
friend class TCollection_BasicMap;
friend class TCollection_MapNode;
friend class TCollection_BasicMapIterator;
friend class TCollection_Map;
friend class TCollection_MapIterator;
friend class TCollection_StdMapNode;
friend class TCollection_DataMap;
friend class TCollection_DataMapIterator;
friend class TCollection_DataMapNode;
friend class TCollection_DoubleMap;
friend class TCollection_DoubleMapIterator;
friend class TCollection_DoubleMapNode;
friend class TCollection_IndexedMap;
friend class TCollection_IndexedMapNode;
friend class TCollection_IndexedDataMap;
friend class TCollection_IndexedDataMapNode;
};
#endif // _TCollection_HeaderFile

View File

@@ -1,177 +0,0 @@
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class Array1 from TCollection (Array1Item as any)
raises RangeError from Standard,
DimensionMismatch from Standard,
OutOfRange from Standard,
OutOfMemory from Standard
---Purpose: The class Array1 represents unidimensionnal arrays
-- of fixed size dynamically dimensioned at construction time..
--
-- The range of the index is user defined.
--
-- As with a C array, the access time to an Array1
-- indexed item is constant and is
-- array-size-independent. Arrays are commonly
-- used as elementary data structures for more complex objects.
-- Array1 is a generic class, which depends on
-- Item, the type of element in the array.
-- An array1 can be constructed with a "C array".
-- This functionality is useful to call methods expecting
-- an Array1. It allows to carry the bounds inside the arrays.
--
-- Examples: Item tab[100]; // An example with a C array
-- Array1OfItem ttab (tab[0],1,100);
--
-- Array1OfItem tttab (ttab(10),10,20); // a slice of ttab
--
-- If you want to reindex an array from 1 to Length do :
--
-- Array1 tab1(tab(tab.Lower()),1,tab.Length());
--
-- Warning: Programs client of such a class must be independant
-- of the range of the first element. Then, a C++ for
-- loop must be written like this
--
-- for (i = A.Lower(); i <= A.Upper(); i++)
is
Create (Low, Up: Integer from Standard)
returns Array1 from TCollection
---Purpose: Creates an array of lower bound <Low> and upper
-- bound <Up>. Range error is raised when <Up> is
-- less than <Low>.
raises
RangeError from Standard,
OutOfMemory from Standard;
---C++: inline
Create(Item : Array1Item;
Low, Up: Integer from Standard)
returns Array1 from TCollection
---Purpose: Creates an array sharing datas with a C array.
-- Example:
-- Item tab[100];
-- Array1OfItem thetab (tab[0],1,100);
--
-- Warning: The validity of Low and Up values are under the responsability
-- of the user.
-- The C array must be a validate address during the life of
-- the Array1.
raises
RangeError from Standard;
---C++: inline
Init (me: in out; V: Array1Item);
---Purpose: Initializes the array with a given value.
Destroy (me: in out);
---Purpose: Frees the allocated area corresponding to the
-- array. If the array was constructed either from a
-- C Array (when method Allocated returns False)
-- the Destroy doesn't delete the area.
--
---C++: alias ~
---C++: inline
IsAllocated (me) returns Boolean from Standard;
---Purpose: Returns True if the data was allocated by the array constructors.
-- (i.e not a slice neither a C array)
---C++: inline
Assign (me: in out; Other: Array1 from TCollection)
returns Array1 from TCollection
---Purpose: Copies the contents of <Other> into <me>. <Other>
-- and <me> must have the same dimension.
-- This method is an alias of operator =.
-- Example
-- TColStd_Array1OfInteger
-- t1(1,20), t2(1,20);
-- t1.Init(3);
-- t2 = t1;
-- assert ( t2(10) == 3 );
-- Exceptions
-- Standard_DimensionMismatch if this array
-- and array Other do not have the same dimension.
---C++: alias operator =
---C++: return const &
raises DimensionMismatch from Standard;
Length (me) returns Integer from Standard;
---Purpose: Returns the number of elements of <me>.
--
---C++: inline
Lower (me) returns Integer from Standard;
---Purpose: Returns the lower bound.
-- Warning
--Client programs of the Array1 class must be independent of the first item range.--
---C++: inline
Upper (me) returns Integer from Standard;
---Purpose: Returns the upper bound.
-- Warning
--Client programs of the Array1 class must be independent of the first item range.--
---C++: inline
SetValue (me : out; Index: Integer from Standard; Value: Array1Item)
---Purpose: Assigns the value <Value> to the <Index>-th item of this array.
-- Example
-- TColStd_Array1OfInteger
-- array(0,100);
-- array.SetValue(3,1515);
-- assert (array(3) == 1515 );
-- Exceptions
-- Standard_OutOfRange if Index lies outside the bounds of this array.
---C++: inline
raises OutOfRange from Standard;
Value (me; Index:Integer from Standard) returns any Array1Item
---Purpose: Return the value of the <Index>th element of the
-- array.
--
---C++: alias operator ()
---C++: return const &
---C++: inline
raises OutOfRange from Standard;
ChangeValue (me: in out; Index:Integer from Standard) returns any Array1Item
---Purpose: return the value of the <Index>th element of the
-- array.
--
---C++: alias operator ()
---C++: return &
---C++: inline
raises OutOfRange from Standard;
Create (AnArray : Array1 from TCollection)
returns Array1 from TCollection
is private;
---Purpose: Creates an Array1 by copy of an Array1.
fields
myLowerBound : Integer;
myUpperBound : Integer;
myStart : Address;
isAllocated : Boolean;
end Array1 ;

View File

@@ -1,183 +0,0 @@
-- Created on: 1992-12-09
-- Copyright (c) 1992-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class Array2 from TCollection (Array2Item as any)
---Purpose: The class Array2 represents bi-dimensionnal arrays
-- of fixed size dynamically dimensioned at construction time.
-- As with a C array, the access time to an Array2 indexed
-- item is constant and independent of the array size. Arrays
-- are commonly used as elementary data structures for more complex objects.
-- Array2 is a generic class, which depends on Item, the type of element in the array.
-- Warning
-- Array2 indexes start and end at a user-defined position.
-- Thus, when accessing an item you must base the indexes
-- on the lower and upper bounds of the array.
raises
RangeError from Standard,
OutOfRange from Standard,
OutOfMemory from Standard,
DimensionMismatch from Standard
is
Create (R1, R2, C1, C2: Integer from Standard)
returns Array2 from TCollection
---Purpose: Creates an array of lower bound <R1><C1> and upper
-- bound <R2><C2>. Range from Standard error is
-- raised when <R2> is less than <R1> or <C2> is less
-- than <C1>.
raises
RangeError from Standard,
OutOfMemory from Standard;
Create (AnArray : Array2)
returns Array2 from TCollection
---Purpose: creates an Array2 by copy of an Array2.
raises OutOfMemory from Standard is private ;
Create (Item : Array2Item; R1, R2, C1, C2: Integer from Standard)
returns Array2 from TCollection
---Purpose: Creates an double array sharing datas with a C array.
-- Examples:
-- Item tab[100][200];
-- Array2OfItem thetab (tab[0][0],1,100,1,200);
-- or
-- Item tab[10000];
-- Array2OfItem thetab (tab[0],1,100,1,100);
--
-- Warning: The validity of R1,R2,C1,C2 values are under the responsability
-- of the user.
-- The C array must be a validate address during the life of
-- the Array2.
raises
RangeError from Standard,
OutOfMemory from Standard;
Init(me : in out; V : Array2Item);
---Purpose: Initializes this array with the value <Value>.
Destroy (me : in out );
---Level: Advanced
---Purpose: Frees the allocated area corresponding to the
-- array. If the array was constructed from a
-- DoubleArray the Destroy doesn't delete the area.
--
---C++: alias ~
Assign (me: in out; Other: Array2)
returns Array2 from TCollection
---Purpose: Copies the contents of <Other> into <me>.
-- <Other> and <me> must have the same dimension.
-- Example
-- TColStd_Array2OfInteger tab1(1,10,1,10);
-- TColStd_Array2OfInteger tab2(11,20,11,20);
-- tab1.Init(4);
-- tab2 = tab1;
-- assert ( tab2(15,15) == 4 );
-- Exceptions
-- Standard_DimensionMismatch if this array and array
-- Other do not have the same dimensions.
---C++: alias operator =
---C++: return const &
raises DimensionMismatch from Standard;
ColLength (me) returns Integer from Standard;
---Level: Public
---Purpose: Return the number of rows of <me>.
--
---C++: inline
RowLength (me) returns Integer from Standard;
---Level: Public
---Purpose: Returns the number of columns of <me>.
--
---C++: inline
LowerCol (me) returns Integer from Standard;
---Level: Public
---Purpose: Returns the lower column number of the array.
--
---C++: inline
LowerRow (me) returns Integer from Standard;
---Level: Public
---Purpose: Returns the lower row number of the array.
--
---C++: inline
UpperCol (me) returns Integer from Standard;
---Level: Public
---Purpose: Returns the upper column number of the array.
--
---C++: inline
UpperRow (me) returns Integer from Standard
---Level: Public
---Purpose: Returns the upper row number of the array.
--
---C++: inline
is static ;
SetValue (me : in out; Row, Col: Integer from Standard; Value: Array2Item)
---Purpose: Purpose
-- Assigns the value Value to the (Row,Col) item of this array.
-- Example
-- TColStd_Array2OfInteger array(0,100,0,100);
-- array.SetValue(3,3,1515);
-- assert ( array(3,3) == 1515 );
-- Exceptions
-- Standard_OutOfRange if Row or Col lies outside the bounds of this array.
---C++: inline
raises OutOfRange from Standard;
Value (me; Row,Col: Integer from Standard) returns any Array2Item
---Level: Public
---Purpose: Returns the value of the element of index
-- <Row><Col>
--
---C++: alias operator()
---C++: return const &
---C++: inline
raises OutOfRange from Standard;
ChangeValue (me: in out; Row,Col: Integer from Standard) returns any Array2Item
---Level: Public
---Purpose: Returns the value of the element of index
-- <Row><Col>
--
---C++: alias operator()
---C++: return &
---C++: inline
raises OutOfRange from Standard;
Allocate (me: in out) raises OutOfMemory is private;
---Level: Private
fields
myLowerRow : Integer from Standard ;
myLowerColumn : Integer from Standard ;
myUpperRow : Integer from Standard ;
myUpperColumn : Integer from Standard ;
myDeletable : Boolean;
myData : Address;
end Array2 ;

View File

@@ -1,843 +0,0 @@
-- Created on: 1993-02-22
-- Created by: Mireille MERCIEN
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class AsciiString from TCollection
---Purpose: A variable-length sequence of ASCII characters
-- (normal 8-bit character type). It provides editing
-- operations with built-in memory management to
-- make AsciiString objects easier to use than
-- ordinary character arrays.
-- AsciiString objects follow value semantics; in
-- other words, they are the actual strings, not
-- handles to strings, and are copied through
-- assignment. You may use HAsciiString objects
-- to get handles to strings.
uses ExtendedString from TCollection
raises
NullObject,
OutOfRange,
NumericError,
NegativeValue
is
Create returns AsciiString from TCollection;
---Purpose: Initializes a AsciiString to an empty AsciiString.
Create ( message : CString ) returns AsciiString from TCollection
---Purpose: Initializes a AsciiString with a CString.
raises NullObject;
Create ( message : CString ; aLen : Integer )
returns AsciiString from TCollection
---Purpose: Initializes a AsciiString with a CString.
raises NullObject;
Create ( aChar : Character) returns AsciiString from TCollection;
---Purpose: Initializes a AsciiString with a single character.
Create ( length : Integer; filler : Character)
returns AsciiString from TCollection;
---Purpose: Initializes an AsciiString with <length> space allocated.
-- and filled with <filler>. This is usefull for buffers.
Create ( value : Integer ) returns AsciiString from TCollection
---Purpose: Initializes an AsciiString with an integer value
raises NullObject;
Create ( value : Real ) returns AsciiString from TCollection
---Purpose: Initializes an AsciiString with a real value
raises NullObject;
Create ( astring : AsciiString from TCollection )
returns AsciiString from TCollection;
---Purpose: Initializes a AsciiString with another AsciiString.
Create ( astring : AsciiString from TCollection ; message : Character )
returns AsciiString from TCollection;
---Purpose: Initializes a AsciiString with copy of another AsciiString
-- concatenated with the message character.
Create ( astring : AsciiString from TCollection ; message : CString )
returns AsciiString from TCollection;
---Purpose: Initializes a AsciiString with copy of another AsciiString
-- concatenated with the message string.
Create ( astring : AsciiString from TCollection ; message : AsciiString )
returns AsciiString from TCollection;
---Purpose: Initializes a AsciiString with copy of another AsciiString
-- concatenated with the message string.
Create(astring : ExtendedString from TCollection;
replaceNonAscii: Character from Standard = 0)
---Purpose: Creation by converting an extended string to an ascii string.
-- If replaceNonAscii is non-null charecter, it will be used
-- in place of any non-ascii character found in the source string.
-- Otherwise, creates UTF-8 unicode string.
returns AsciiString from TCollection
raises OutOfRange from Standard;
AssignCat (me : out ; other : Character )
---Level: Public
---Purpose: Appends <other> to me. This is an unary operator.
---C++: alias operator +=
raises NullObject from Standard
is static;
AssignCat (me : out ; other : Integer from Standard )
---Level: Public
---Purpose: Appends <other> to me. This is an unary operator.
---C++: alias operator +=
raises NullObject from Standard
is static;
AssignCat (me : out ; other : Real from Standard )
---Level: Public
---Purpose: Appends <other> to me. This is an unary operator.
---C++: alias operator +=
raises NullObject from Standard
is static;
AssignCat (me : out ; other : CString)
---Level: Public
---Purpose: Appends <other> to me. This is an unary operator.
-- ex: aString += "Dummy"
-- To catenate more than one CString, you must put a
-- AsciiString before.
-- Example: aString += "Hello " + "Dolly" IS NOT VALID !
-- But astring += anotherString + "Hello " + "Dolly" is valid.
---C++: alias operator +=
raises NullObject from Standard
is static;
AssignCat (me : out ; other : AsciiString from TCollection)
---Level: Public
---Purpose: Appends <other> to me. This is an unary operator.
-- Example: aString += anotherString
---C++: alias operator +=
is static;
Capitalize(me : out)
---Level: Public
---Purpose: Converts the first character into its corresponding
-- upper-case character and the other characters into lowercase
-- Example: before
-- me = "hellO "
-- after
-- me = "Hello "
is static;
-- Cat(me; other : CString from Standard; result : out AsciiString from TCollection )
-- is private;
Cat (me ; other : Character from Standard) returns AsciiString from TCollection
---Level: Public
---Purpose: Appends <other> to me.
-- Syntax:
-- aString = aString + "Dummy"
-- Example: aString contains "I say "
-- aString = aString + "Hello " + "Dolly"
-- gives "I say Hello Dolly"
-- To catenate more than one CString, you must put a String before.
-- So the following example is WRONG !
-- aString = "Hello " + "Dolly" THIS IS NOT ALLOWED
-- This rule is applicable to AssignCat (operator +=) too.
---C++: alias operator +
---C++: inline
raises NullObject from Standard
is static;
Cat (me ; other : Integer from Standard) returns AsciiString from TCollection
---Level: Public
---Purpose: Appends <other> to me.
-- Syntax:
-- aString = aString + 15;
-- Example: aString contains "I say "
-- gives "I say 15"
-- To catenate more than one CString, you must put a String before.
-- So the following example is WRONG !
-- aString = "Hello " + "Dolly" THIS IS NOT ALLOWED
-- This rule is applicable to AssignCat (operator +=) too.
---C++: alias operator +
---C++: inline
raises NullObject from Standard
is static;
Cat (me ; other : Real from Standard) returns AsciiString from TCollection
---Level: Public
---Purpose: Appends <other> to me.
-- Syntax:
-- aString = aString + 15.15;
-- Example: aString contains "I say "
-- gives "I say 15.15"
-- To catenate more than one CString, you must put a String before.
-- So the following example is WRONG !
-- aString = "Hello " + "Dolly" THIS IS NOT ALLOWED
-- This rule is applicable to AssignCat (operator +=) too.
---C++: alias operator +
---C++: inline
raises NullObject from Standard
is static;
Cat (me ; other : CString from Standard)
returns AsciiString from TCollection
---Level: Public
---Purpose: Appends <other> to me.
-- Syntax:
-- aString = aString + "Dummy"
-- Example: aString contains "I say "
-- aString = aString + "Hello " + "Dolly"
-- gives "I say Hello Dolly"
-- To catenate more than one CString, you must put a String before.
-- So the following example is WRONG !
-- aString = "Hello " + "Dolly" THIS IS NOT ALLOWED
-- This rule is applicable to AssignCat (operator +=) too.
---C++: alias operator +
---C++: inline
is static;
-- Cat(me; other : AsciiString from TCollection;
-- result : out AsciiString from TCollection )
-- is private;
Cat (me ; other : AsciiString from TCollection)
returns AsciiString from TCollection
---Level: Public
---Purpose: Appends <other> to me.
-- Example: aString = aString + anotherString
---C++: alias operator +
---C++: inline
is static;
Center(me : out;
Width : Integer from Standard;
Filler : Character from Standard)
raises NegativeValue from Standard
---Purpose: Modifies this ASCII string so that its length
-- becomes equal to Width and the new characters
-- are equal to Filler. New characters are added
-- both at the beginning and at the end of this string.
-- If Width is less than the length of this ASCII string, nothing happens.
-- Example
-- TCollection_AsciiString
-- myAlphabet("abcdef");
-- myAlphabet.Center(9,' ');
-- assert ( myAlphabet == "
-- abcdef " );
is static;
ChangeAll(me : out; aChar, NewChar : Character;
CaseSensitive : Boolean=Standard_True)
---Level: Public
---Purpose: Substitutes all the characters equal to aChar by NewChar
-- in the AsciiString <me>.
-- The substitution can be case sensitive.
-- If you don't use default case sensitive, no matter wether aChar
-- is uppercase or not.
-- Example: me = "Histake" -> ChangeAll('H','M',Standard_True)
-- gives me = "Mistake"
is static;
Clear (me : out)
---Level: Public
---Purpose: Removes all characters contained in <me>.
-- This produces an empty AsciiString.
is static;
Copy (me : out ; fromwhere : CString from Standard)
---Level: Public
---Purpose: Copy <fromwhere> to <me>.
-- Used as operator =
-- Example: aString = anotherCString;
---C++: alias operator =
is static;
Copy (me : out ; fromwhere : AsciiString from TCollection)
---Level: Public
---Purpose: Copy <fromwhere> to <me>.
-- Used as operator =
-- Example: aString = anotherString;
---C++: alias operator =
is static;
Destroy (me : in out)
---Level: Public
---Purpose: Frees memory allocated by AsciiString.
---C++: alias ~
is static;
FirstLocationInSet(me; Set : AsciiString from TCollection;
FromIndex : Integer from Standard;
ToIndex : Integer from Standard)
returns Integer
raises OutOfRange from Standard
is static;
---Level: Public
---Purpose: Returns the index of the first character of <me> that is
-- present in <Set>.
-- The search begins to the index FromIndex and ends to the
-- the index ToIndex.
-- Returns zero if failure.
-- Raises an exception if FromIndex or ToIndex is out of range.
-- Example: before
-- me = "aabAcAa", S = "Aa", FromIndex = 1, Toindex = 7
-- after
-- me = "aabAcAa"
-- returns
-- 1
FirstLocationNotInSet(me; Set : AsciiString from TCollection;
FromIndex : Integer;
ToIndex : Integer) returns Integer
raises OutOfRange from Standard
is static;
---Level: Public
---Purpose: Returns the index of the first character of <me>
-- that is not present in the set <Set>.
-- The search begins to the index FromIndex and ends to the
-- the index ToIndex in <me>.
-- Returns zero if failure.
-- Raises an exception if FromIndex or ToIndex is out of range.
-- Example: before
-- me = "aabAcAa", S = "Aa", FromIndex = 1, Toindex = 7
-- after
-- me = "aabAcAa"
-- returns
-- 3
Insert (me : out; where : Integer; what : Character)
---Level: Public
---Purpose: Inserts a Character at position <where>.
-- Example:
-- aString contains "hy not ?"
-- aString.Insert(1,'W'); gives "Why not ?"
-- aString contains "Wh"
-- aString.Insert(3,'y'); gives "Why"
-- aString contains "Way"
-- aString.Insert(2,'h'); gives "Why"
raises OutOfRange from Standard
is static;
Insert (me : out; where : Integer; what : CString)
---Level: Public
---Purpose: Inserts a CString at position <where>.
-- Example:
-- aString contains "O more"
-- aString.Insert(2,"nce"); gives "Once more"
raises NullObject from Standard,
OutOfRange from Standard
is static;
Insert (me : out; where : Integer; what : AsciiString from TCollection)
---Level: Public
---Purpose: Inserts a AsciiString at position <where>.
raises OutOfRange;
InsertAfter(me : out; Index : Integer;
other : AsciiString from TCollection)
raises OutOfRange from Standard
is static;
---Level: Public
---Purpose: Pushing a string after a specific index in the string <me>.
-- Raises an exception if Index is out of bounds.
-- - less than 0 (InsertAfter), or less than 1 (InsertBefore), or
-- - greater than the number of characters in this ASCII string.
-- Example:
-- before
-- me = "cde" , Index = 0 , other = "ab"
-- after
-- me = "abcde" , other = "ab"
InsertBefore(me : out; Index : Integer;
other : AsciiString from TCollection)
raises OutOfRange from Standard
is static;
---Level: Public
---Purpose: Pushing a string before a specific index in the string <me>.
-- Raises an exception if Index is out of bounds.
-- - less than 0 (InsertAfter), or less than 1 (InsertBefore), or
-- - greater than the number of characters in this ASCII string.
-- Example:
-- before
-- me = "cde" , Index = 1 , other = "ab"
-- after
-- me = "abcde" , other = "ab"
IsEmpty(me) returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns True if the string <me> contains zero character.
IsEqual (me ; other : CString) returns Boolean
---Purpose: Returns true if the characters in this ASCII string
-- are identical to the characters in ASCII string other.
-- Note that this method is an alias of operator ==.
raises NullObject from Standard
is static;
---C++: alias operator ==
IsEqual (me ; other : AsciiString from TCollection)
returns Boolean from Standard
is static;
---Purpose: Returns true if the characters in this ASCII string
-- are identical to the characters in ASCII string other.
-- Note that this method is an alias of operator ==.
---C++: alias operator ==
IsDifferent (me ; other : CString)
returns Boolean from Standard
---Level: Public
---Purpose: Returns true if there are differences between the
-- characters in this ASCII string and ASCII string other.
-- Note that this method is an alias of operator !=
raises NullObject from Standard
is static;
---C++: alias operator !=
IsDifferent (me ; other : AsciiString from TCollection)
returns Boolean from Standard
is static;
---Purpose: Returns true if there are differences between the
-- characters in this ASCII string and ASCII string other.
-- Note that this method is an alias of operator !=
---C++: alias operator !=
IsLess (me ; other : CString) returns Boolean from Standard
---Level: Public
---Purpose: Returns TRUE if <me> is 'ASCII' less than <other>.
raises NullObject from Standard
---C++: alias operator <
is static;
IsLess (me ; other : AsciiString from TCollection)
returns Boolean from Standard
---Level: Public
---Purpose: Returns TRUE if <me> is 'ASCII' less than <other>.
---C++: alias operator <
is static;
IsGreater (me ; other : CString) returns Boolean from Standard
---Level: Public
---Purpose: Returns TRUE if <me> is 'ASCII' greater than <other>.
raises NullObject from Standard
is static;
---C++: alias operator >
IsGreater (me ; other : AsciiString from TCollection)
returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns TRUE if <me> is 'ASCII' greater than <other>.
---C++: alias operator >
IntegerValue(me)
returns Integer from Standard
---Level: Public
---Purpose: Converts a AsciiString containing a numeric expression to
-- an Integer.
-- Example: "215" returns 215.
raises NumericError from Standard
is static;
IsIntegerValue(me) returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns True if the AsciiString contains an integer value.
-- Note: an integer value is considered to be a real value as well.
IsRealValue(me) returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns True if the AsciiString contains a real value.
-- Note: an integer value is considered to be a real value as well.
IsAscii(me) returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns True if the AsciiString contains only ASCII characters
-- between ' ' and '~'.
-- This means no control character and no extended ASCII code.
LeftAdjust(me : out)
is static;
---Level: Public
---Purpose: Removes all space characters in the begining of the string.
LeftJustify(me : out; Width : Integer;
Filler : Character from Standard)
raises NegativeValue from Standard
is static;
---Level: Public
---Purpose: left justify
-- Length becomes equal to Width and the new characters are
-- equal to Filler.
-- If Width < Length nothing happens.
-- Raises an exception if Width is less than zero.
-- Example:
-- before
-- me = "abcdef" , Width = 9 , Filler = ' '
-- after
-- me = "abcdef "
Length (me) returns Integer
is static;
---C++: inline
---Level: Public
---Purpose: Returns number of characters in <me>.
-- This is the same functionality as 'strlen' in C.
-- Example
-- TCollection_AsciiString myAlphabet("abcdef");
-- assert ( myAlphabet.Length() == 6 );
-- - 1 is the position of the first character in this string.
-- - The length of this string gives the position of its last character.
-- - Positions less than or equal to zero, or
-- greater than the length of this string are
-- invalid in functions which identify a character
-- of this string by its position.
Location(me; other : AsciiString from TCollection;
FromIndex : Integer;
ToIndex : Integer)
returns Integer from Standard
raises OutOfRange from Standard
is static;
---Level: Public
---Purpose: Returns an index in the string <me> of the first occurence
-- of the string S in the string <me> from the starting index
-- FromIndex to the ending index ToIndex
-- returns zero if failure
-- Raises an exception if FromIndex or ToIndex is out of range.
-- Example:
-- before
-- me = "aabAaAa", S = "Aa", FromIndex = 1, ToIndex = 7
-- after
-- me = "aabAaAa"
-- returns
-- 4
Location(me; N : Integer; C : Character from Standard;
FromIndex : Integer;
ToIndex : Integer)
returns Integer from Standard
raises OutOfRange from Standard
is static;
---Level: Public
---Purpose: Returns the index of the nth occurence of the character C
-- in the string <me> from the starting index FromIndex to the
-- ending index ToIndex.
-- Returns zero if failure.
-- Raises an exception if FromIndex or ToIndex is out of range.
-- Example:
-- before
-- me = "aabAa", N = 3, C = 'a', FromIndex = 1, ToIndex = 5
-- after
-- me = "aabAa"
-- returns
-- 5
LowerCase (me : out)
is static;
---Level: Public
---Purpose: Converts <me> to its lower-case equivalent.
-- Example
-- TCollection_AsciiString myString("Hello Dolly");
-- myString.UpperCase();
-- assert ( myString == "HELLO DOLLY" );
-- myString.LowerCase();
-- assert ( myString == "hello dolly" );
Prepend(me : out; other : AsciiString from TCollection)
is static;
---Level: Public
---Purpose: Inserts the string other at the beginning of this ASCII string.
-- Example
-- TCollection_AsciiString myAlphabet("cde");
-- TCollection_AsciiString myBegin("ab");
-- myAlphabet.Prepend(myBegin);
-- assert ( myAlphabet == "abcde" );
Print (me ; astream : out OStream)
is static;
---Level: Public
---Purpose: Displays <me> on a stream.
---C++: alias "friend Standard_EXPORT Standard_OStream& operator << (Standard_OStream& astream,const TCollection_AsciiString& astring);"
Read (me : out; astream : out IStream)
is static;
---Level: Public
---Purpose: Read <me> from a stream.
---C++: alias "friend Standard_EXPORT Standard_IStream& operator >> (Standard_IStream& astream, TCollection_AsciiString& astring);"
RealValue(me) returns Real from Standard
---Level: Public
---Purpose: Converts an AsciiString containing a numeric expression.
-- to a Real.
-- Example: ex: "215" returns 215.0.
-- ex: "3.14159267" returns 3.14159267.
raises NumericError from Standard
is static;
RemoveAll(me :out; C : Character from Standard;
CaseSensitive : Boolean from Standard)
is static;
---Level: Public
---Purpose: Remove all the occurences of the character C in the string.
-- Example:
-- before
-- me = "HellLLo", C = 'L' , CaseSensitive = True
-- after
-- me = "Hello"
RemoveAll(me : out; what : Character)
is static;
---Level: Public
---Purpose: Removes every <what> characters from <me>.
Remove (me : out ; where : Integer ; ahowmany : Integer=1)
---Level: Public
---Purpose: Erases <ahowmany> characters from position <where>,
-- <where> included.
-- Example:
-- aString contains "Hello"
-- aString.Remove(2,2) erases 2 characters from position 2
-- This gives "Hlo".
raises OutOfRange from Standard
is static;
RightAdjust(me : out)
is static;
---Level: Public
---Purpose: Removes all space characters at the end of the string.
RightJustify(me : out;
Width : Integer;
Filler : Character from Standard)
raises NegativeValue from Standard
is static;
---Level: Public
---Purpose: Right justify.
-- Length becomes equal to Width and the new characters are
-- equal to Filler.
-- if Width < Length nothing happens.
-- Raises an exception if Width is less than zero.
-- Example:
-- before
-- me = "abcdef" , Width = 9 , Filler = ' '
-- after
-- me = " abcdef"
Search (me ; what : CString) returns Integer from Standard
---Level: Public
---Purpose: Searches a CString in <me> from the beginning
-- and returns position of first item <what> matching.
-- it returns -1 if not found.
-- Example:
-- aString contains "Sample single test"
-- aString.Search("le") returns 5
raises NullObject from Standard
is static;
Search (me ; what : AsciiString from TCollection)
returns Integer from Standard
is static;
---Level: Public
---Purpose: Searches an AsciiString in <me> from the beginning
-- and returns position of first item <what> matching.
-- It returns -1 if not found.
SearchFromEnd (me ; what : CString)
returns Integer from Standard
---Level: Public
---Purpose: Searches a CString in a AsciiString from the end
-- and returns position of first item <what> matching.
-- It returns -1 if not found.
-- Example:
-- aString contains "Sample single test"
-- aString.SearchFromEnd("le") returns 12
raises NullObject from Standard
is static;
SearchFromEnd (me ; what : AsciiString from TCollection)
returns Integer from Standard
is static;
---Level: Public
---Purpose: Searches a AsciiString in another AsciiString from the end
-- and returns position of first item <what> matching.
-- It returns -1 if not found.
SetValue(me : out; where : Integer; what : Character)
---Level: Public
---Purpose: Replaces one character in the AsciiString at position <where>.
-- If <where> is less than zero or greater than the length of <me>
-- an exception is raised.
-- Example:
-- aString contains "Garbake"
-- astring.Replace(6,'g') gives <me> = "Garbage"
raises OutOfRange from Standard
is static;
SetValue(me : out; where : Integer; what : CString)
---Level: Public
---Purpose: Replaces a part of <me> by a CString.
-- If <where> is less than zero or greater than the length of <me>
-- an exception is raised.
-- Example:
-- aString contains "abcde"
-- aString.SetValue(4,"1234567") gives <me> = "abc1234567"
raises OutOfRange from Standard
is static;
SetValue(me : out; where : Integer; what : AsciiString from TCollection)
---Level: Public
---Purpose: Replaces a part of <me> by another AsciiString.
raises OutOfRange from Standard
is static;
Split(me : out; where : Integer; result : out AsciiString from TCollection)
is private;
Split(me : out; where : Integer)
returns AsciiString from TCollection
---Level: Public
---Purpose: Splits a AsciiString into two sub-strings.
-- Example:
-- aString contains "abcdefg"
-- aString.Split(3) gives <me> = "abc" and returns "defg"
raises OutOfRange from Standard
is static;
SubString(me; FromIndex, ToIndex : Integer;
result : out AsciiString from TCollection)
is private;
SubString(me; FromIndex, ToIndex : Integer)
---Level: Public
---Purpose: Creation of a sub-string of the string <me>.
-- The sub-string starts to the index Fromindex and ends
-- to the index ToIndex.
-- Raises an exception if ToIndex or FromIndex is out of bounds
-- Example:
-- before
-- me = "abcdefg", ToIndex=3, FromIndex=6
-- after
-- me = "abcdefg"
-- returns
-- "cdef"
---C++: inline
returns AsciiString from TCollection
raises OutOfRange from Standard
is static;
ToCString(me)
returns CString from Standard
is static;
---Level: Public
---Purpose: Returns pointer to AsciiString (char *).
-- This is useful for some casual manipulations.
-- Warning: Because this "char *" is 'const', you can't modify its contents.
---C++: inline
Token (me ; separators : CString ;
whichone : Integer;
result : out AsciiString from TCollection)
is private;
Token (me ; separators : CString=" \t" ; whichone : Integer=1)
returns AsciiString from TCollection
---Level: Public
---Purpose: Extracts <whichone> token from <me>.
-- By default, the <separators> is set to space and tabulation.
-- By default, the token extracted is the first one (whichone = 1).
-- <separators> contains all separators you need.
-- If no token indexed by <whichone> is found, it returns empty AsciiString.
-- Example:
-- aString contains "This is a message"
-- aString.Token() returns "This"
-- aString.Token(" ",4) returns "message"
-- aString.Token(" ",2) returns "is"
-- aString.Token(" ",9) returns ""
-- Other separators than space character and tabulation are allowed :
-- aString contains "1234; test:message , value"
-- aString.Token("; :,",4) returns "value"
-- aString.Token("; :,",2) returns "test"
raises NullObject from Standard
is static;
Trunc (me : out ; ahowmany : Integer)
---Level: Public
---Purpose: Truncates <me> to <ahowmany> characters.
-- Example: me = "Hello Dolly" -> Trunc(3) -> me = "Hel"
raises OutOfRange from Standard
is static;
UpperCase (me : out)
is static;
---Level: Public
---Purpose: Converts <me> to its upper-case equivalent.
UsefullLength(me)
returns Integer from Standard
is static;
---Level: Public
---Purpose: Length of the string ignoring all spaces (' ') and the
-- control character at the end.
Value(me ; where : Integer)
returns Character from Standard
---Level: Public
---Purpose: Returns character at position <where> in <me>.
-- If <where> is less than zero or greater than the lenght of <me>,
-- an exception is raised.
-- Example:
-- aString contains "Hello"
-- aString.Value(2) returns 'e'
raises OutOfRange from Standard
is static;
HashCode(myclass ; astring : AsciiString from TCollection; Upper : Integer)
returns Integer;
---Level: Internal
---Purpose: Hash function for AsciiString
-- (returns the same Integer value that the hash function for ExtendedString)
---C++: inline
IsEqual(myclass ; string1 : AsciiString from TCollection;
string2 : AsciiString from TCollection)
returns Boolean;
---Level: Internal
---Purpose: Returns True when the two strings are the same.
-- (Just for HashCode for AsciiString)
---C++: inline
IsEqual(myclass ; string1 : AsciiString from TCollection;
string2 : CString from Standard)
returns Boolean;
---Level: Internal
---Purpose: Returns True when the two strings are the same.
-- (Just for HashCode for AsciiString)
---C++: inline
fields
mystring : PCharacter;
mylength : Integer;
friends
class HAsciiString from TCollection
end AsciiString from TCollection;

View File

@@ -12,19 +12,19 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TCollection_AsciiString.ixx>
#include <TCollection_ExtendedString.hxx>
#include <Standard.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_NegativeValue.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_NumericError.hxx>
#include <Standard_OutOfRange.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TCollection_HAsciiString.hxx>
#include <cstdio>
#include <cctype>
#include <cstdio>
#include <cstring>
// Shortcuts to standard allocate and reallocate functions
static inline Standard_PCharacter Allocate(const Standard_Size aLength)
{

View File

@@ -0,0 +1,695 @@
// Created on: 1993-02-22
// Created by: Mireille MERCIEN
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TCollection_AsciiString_HeaderFile
#define _TCollection_AsciiString_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_PCharacter.hxx>
#include <Standard_Integer.hxx>
#include <Standard_CString.hxx>
#include <Standard_Character.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
class Standard_NullObject;
class Standard_OutOfRange;
class Standard_NumericError;
class Standard_NegativeValue;
class TCollection_HAsciiString;
class TCollection_ExtendedString;
//! A variable-length sequence of ASCII characters
//! (normal 8-bit character type). It provides editing
//! operations with built-in memory management to
//! make AsciiString objects easier to use than
//! ordinary character arrays.
//! AsciiString objects follow value semantics; in
//! other words, they are the actual strings, not
//! handles to strings, and are copied through
//! assignment. You may use HAsciiString objects
//! to get handles to strings.
class TCollection_AsciiString
{
public:
DEFINE_STANDARD_ALLOC
//! Initializes a AsciiString to an empty AsciiString.
Standard_EXPORT TCollection_AsciiString();
//! Initializes a AsciiString with a CString.
Standard_EXPORT TCollection_AsciiString(const Standard_CString message);
//! Initializes a AsciiString with a CString.
Standard_EXPORT TCollection_AsciiString(const Standard_CString message, const Standard_Integer aLen);
//! Initializes a AsciiString with a single character.
Standard_EXPORT TCollection_AsciiString(const Standard_Character aChar);
//! Initializes an AsciiString with <length> space allocated.
//! and filled with <filler>. This is usefull for buffers.
Standard_EXPORT TCollection_AsciiString(const Standard_Integer length, const Standard_Character filler);
//! Initializes an AsciiString with an integer value
Standard_EXPORT TCollection_AsciiString(const Standard_Integer value);
//! Initializes an AsciiString with a real value
Standard_EXPORT TCollection_AsciiString(const Standard_Real value);
//! Initializes a AsciiString with another AsciiString.
Standard_EXPORT TCollection_AsciiString(const TCollection_AsciiString& astring);
//! Initializes a AsciiString with copy of another AsciiString
//! concatenated with the message character.
Standard_EXPORT TCollection_AsciiString(const TCollection_AsciiString& astring, const Standard_Character message);
//! Initializes a AsciiString with copy of another AsciiString
//! concatenated with the message string.
Standard_EXPORT TCollection_AsciiString(const TCollection_AsciiString& astring, const Standard_CString message);
//! Initializes a AsciiString with copy of another AsciiString
//! concatenated with the message string.
Standard_EXPORT TCollection_AsciiString(const TCollection_AsciiString& astring, const TCollection_AsciiString& message);
//! Creation by converting an extended string to an ascii string.
//! If replaceNonAscii is non-null charecter, it will be used
//! in place of any non-ascii character found in the source string.
//! Otherwise, creates UTF-8 unicode string.
Standard_EXPORT TCollection_AsciiString(const TCollection_ExtendedString& astring, const Standard_Character replaceNonAscii = 0);
//! Appends <other> to me. This is an unary operator.
Standard_EXPORT void AssignCat (const Standard_Character other);
void operator += (const Standard_Character other)
{
AssignCat(other);
}
//! Appends <other> to me. This is an unary operator.
Standard_EXPORT void AssignCat (const Standard_Integer other);
void operator += (const Standard_Integer other)
{
AssignCat(other);
}
//! Appends <other> to me. This is an unary operator.
Standard_EXPORT void AssignCat (const Standard_Real other);
void operator += (const Standard_Real other)
{
AssignCat(other);
}
//! Appends <other> to me. This is an unary operator.
//! ex: aString += "Dummy"
//! To catenate more than one CString, you must put a
//! AsciiString before.
//! Example: aString += "Hello " + "Dolly" IS NOT VALID !
//! But astring += anotherString + "Hello " + "Dolly" is valid.
Standard_EXPORT void AssignCat (const Standard_CString other);
void operator += (const Standard_CString other)
{
AssignCat(other);
}
//! Appends <other> to me. This is an unary operator.
//! Example: aString += anotherString
Standard_EXPORT void AssignCat (const TCollection_AsciiString& other);
void operator += (const TCollection_AsciiString& other)
{
AssignCat(other);
}
//! Converts the first character into its corresponding
//! upper-case character and the other characters into lowercase
//! Example: before
//! me = "hellO "
//! after
//! me = "Hello "
Standard_EXPORT void Capitalize();
//! Appends <other> to me.
//! Syntax:
//! aString = aString + "Dummy"
//! Example: aString contains "I say "
//! aString = aString + "Hello " + "Dolly"
//! gives "I say Hello Dolly"
//! To catenate more than one CString, you must put a String before.
//! So the following example is WRONG !
//! aString = "Hello " + "Dolly" THIS IS NOT ALLOWED
//! This rule is applicable to AssignCat (operator +=) too.
TCollection_AsciiString Cat (const Standard_Character other) const;
TCollection_AsciiString operator + (const Standard_Character other) const
{
return Cat(other);
}
//! Appends <other> to me.
//! Syntax:
//! aString = aString + 15;
//! Example: aString contains "I say "
//! gives "I say 15"
//! To catenate more than one CString, you must put a String before.
//! So the following example is WRONG !
//! aString = "Hello " + "Dolly" THIS IS NOT ALLOWED
//! This rule is applicable to AssignCat (operator +=) too.
TCollection_AsciiString Cat (const Standard_Integer other) const;
TCollection_AsciiString operator + (const Standard_Integer other) const
{
return Cat(other);
}
//! Appends <other> to me.
//! Syntax:
//! aString = aString + 15.15;
//! Example: aString contains "I say "
//! gives "I say 15.15"
//! To catenate more than one CString, you must put a String before.
//! So the following example is WRONG !
//! aString = "Hello " + "Dolly" THIS IS NOT ALLOWED
//! This rule is applicable to AssignCat (operator +=) too.
TCollection_AsciiString Cat (const Standard_Real other) const;
TCollection_AsciiString operator + (const Standard_Real other) const
{
return Cat(other);
}
//! Appends <other> to me.
//! Syntax:
//! aString = aString + "Dummy"
//! Example: aString contains "I say "
//! aString = aString + "Hello " + "Dolly"
//! gives "I say Hello Dolly"
//! To catenate more than one CString, you must put a String before.
//! So the following example is WRONG !
//! aString = "Hello " + "Dolly" THIS IS NOT ALLOWED
//! This rule is applicable to AssignCat (operator +=) too.
TCollection_AsciiString Cat (const Standard_CString other) const;
TCollection_AsciiString operator + (const Standard_CString other) const
{
return Cat(other);
}
//! Appends <other> to me.
//! Example: aString = aString + anotherString
TCollection_AsciiString Cat (const TCollection_AsciiString& other) const;
TCollection_AsciiString operator + (const TCollection_AsciiString& other) const
{
return Cat(other);
}
//! Modifies this ASCII string so that its length
//! becomes equal to Width and the new characters
//! are equal to Filler. New characters are added
//! both at the beginning and at the end of this string.
//! If Width is less than the length of this ASCII string, nothing happens.
//! Example
//! TCollection_AsciiString
//! myAlphabet("abcdef");
//! myAlphabet.Center(9,' ');
//! assert ( myAlphabet == "
//! abcdef " );
Standard_EXPORT void Center (const Standard_Integer Width, const Standard_Character Filler);
//! Substitutes all the characters equal to aChar by NewChar
//! in the AsciiString <me>.
//! The substitution can be case sensitive.
//! If you don't use default case sensitive, no matter wether aChar
//! is uppercase or not.
//! Example: me = "Histake" -> ChangeAll('H','M',Standard_True)
//! gives me = "Mistake"
Standard_EXPORT void ChangeAll (const Standard_Character aChar, const Standard_Character NewChar, const Standard_Boolean CaseSensitive = Standard_True);
//! Removes all characters contained in <me>.
//! This produces an empty AsciiString.
Standard_EXPORT void Clear();
//! Copy <fromwhere> to <me>.
//! Used as operator =
//! Example: aString = anotherCString;
Standard_EXPORT void Copy (const Standard_CString fromwhere);
void operator = (const Standard_CString fromwhere)
{
Copy(fromwhere);
}
//! Copy <fromwhere> to <me>.
//! Used as operator =
//! Example: aString = anotherString;
Standard_EXPORT void Copy (const TCollection_AsciiString& fromwhere);
void operator = (const TCollection_AsciiString& fromwhere)
{
Copy(fromwhere);
}
//! Frees memory allocated by AsciiString.
Standard_EXPORT void Destroy();
~TCollection_AsciiString()
{
Destroy();
}
//! Returns the index of the first character of <me> that is
//! present in <Set>.
//! The search begins to the index FromIndex and ends to the
//! the index ToIndex.
//! Returns zero if failure.
//! Raises an exception if FromIndex or ToIndex is out of range.
//! Example: before
//! me = "aabAcAa", S = "Aa", FromIndex = 1, Toindex = 7
//! after
//! me = "aabAcAa"
//! returns
//! 1
Standard_EXPORT Standard_Integer FirstLocationInSet (const TCollection_AsciiString& Set, const Standard_Integer FromIndex, const Standard_Integer ToIndex) const;
//! Returns the index of the first character of <me>
//! that is not present in the set <Set>.
//! The search begins to the index FromIndex and ends to the
//! the index ToIndex in <me>.
//! Returns zero if failure.
//! Raises an exception if FromIndex or ToIndex is out of range.
//! Example: before
//! me = "aabAcAa", S = "Aa", FromIndex = 1, Toindex = 7
//! after
//! me = "aabAcAa"
//! returns
//! 3
Standard_EXPORT Standard_Integer FirstLocationNotInSet (const TCollection_AsciiString& Set, const Standard_Integer FromIndex, const Standard_Integer ToIndex) const;
//! Inserts a Character at position <where>.
//! Example:
//! aString contains "hy not ?"
//! aString.Insert(1,'W'); gives "Why not ?"
//! aString contains "Wh"
//! aString.Insert(3,'y'); gives "Why"
//! aString contains "Way"
//! aString.Insert(2,'h'); gives "Why"
Standard_EXPORT void Insert (const Standard_Integer where, const Standard_Character what);
//! Inserts a CString at position <where>.
//! Example:
//! aString contains "O more"
//! aString.Insert(2,"nce"); gives "Once more"
Standard_EXPORT void Insert (const Standard_Integer where, const Standard_CString what);
//! Inserts a AsciiString at position <where>.
Standard_EXPORT void Insert (const Standard_Integer where, const TCollection_AsciiString& what);
//! Pushing a string after a specific index in the string <me>.
//! Raises an exception if Index is out of bounds.
//! - less than 0 (InsertAfter), or less than 1 (InsertBefore), or
//! - greater than the number of characters in this ASCII string.
//! Example:
//! before
//! me = "cde" , Index = 0 , other = "ab"
//! after
//! me = "abcde" , other = "ab"
Standard_EXPORT void InsertAfter (const Standard_Integer Index, const TCollection_AsciiString& other);
//! Pushing a string before a specific index in the string <me>.
//! Raises an exception if Index is out of bounds.
//! - less than 0 (InsertAfter), or less than 1 (InsertBefore), or
//! - greater than the number of characters in this ASCII string.
//! Example:
//! before
//! me = "cde" , Index = 1 , other = "ab"
//! after
//! me = "abcde" , other = "ab"
Standard_EXPORT void InsertBefore (const Standard_Integer Index, const TCollection_AsciiString& other);
//! Returns True if the string <me> contains zero character.
Standard_EXPORT Standard_Boolean IsEmpty() const;
//! Returns true if the characters in this ASCII string
//! are identical to the characters in ASCII string other.
//! Note that this method is an alias of operator ==.
Standard_EXPORT Standard_Boolean IsEqual (const Standard_CString other) const;
Standard_Boolean operator == (const Standard_CString other) const
{
return IsEqual(other);
}
//! Returns true if the characters in this ASCII string
//! are identical to the characters in ASCII string other.
//! Note that this method is an alias of operator ==.
Standard_EXPORT Standard_Boolean IsEqual (const TCollection_AsciiString& other) const;
Standard_Boolean operator == (const TCollection_AsciiString& other) const
{
return IsEqual(other);
}
//! Returns true if there are differences between the
//! characters in this ASCII string and ASCII string other.
//! Note that this method is an alias of operator !=
Standard_EXPORT Standard_Boolean IsDifferent (const Standard_CString other) const;
Standard_Boolean operator != (const Standard_CString other) const
{
return IsDifferent(other);
}
//! Returns true if there are differences between the
//! characters in this ASCII string and ASCII string other.
//! Note that this method is an alias of operator !=
Standard_EXPORT Standard_Boolean IsDifferent (const TCollection_AsciiString& other) const;
Standard_Boolean operator != (const TCollection_AsciiString& other) const
{
return IsDifferent(other);
}
//! Returns TRUE if <me> is 'ASCII' less than <other>.
Standard_EXPORT Standard_Boolean IsLess (const Standard_CString other) const;
Standard_Boolean operator < (const Standard_CString other) const
{
return IsLess(other);
}
//! Returns TRUE if <me> is 'ASCII' less than <other>.
Standard_EXPORT Standard_Boolean IsLess (const TCollection_AsciiString& other) const;
Standard_Boolean operator < (const TCollection_AsciiString& other) const
{
return IsLess(other);
}
//! Returns TRUE if <me> is 'ASCII' greater than <other>.
Standard_EXPORT Standard_Boolean IsGreater (const Standard_CString other) const;
Standard_Boolean operator > (const Standard_CString other) const
{
return IsGreater(other);
}
//! Returns TRUE if <me> is 'ASCII' greater than <other>.
Standard_EXPORT Standard_Boolean IsGreater (const TCollection_AsciiString& other) const;
Standard_Boolean operator > (const TCollection_AsciiString& other) const
{
return IsGreater(other);
}
//! Converts a AsciiString containing a numeric expression to
//! an Integer.
//! Example: "215" returns 215.
Standard_EXPORT Standard_Integer IntegerValue() const;
//! Returns True if the AsciiString contains an integer value.
//! Note: an integer value is considered to be a real value as well.
Standard_EXPORT Standard_Boolean IsIntegerValue() const;
//! Returns True if the AsciiString contains a real value.
//! Note: an integer value is considered to be a real value as well.
Standard_EXPORT Standard_Boolean IsRealValue() const;
//! Returns True if the AsciiString contains only ASCII characters
//! between ' ' and '~'.
//! This means no control character and no extended ASCII code.
Standard_EXPORT Standard_Boolean IsAscii() const;
//! Removes all space characters in the begining of the string.
Standard_EXPORT void LeftAdjust();
//! left justify
//! Length becomes equal to Width and the new characters are
//! equal to Filler.
//! If Width < Length nothing happens.
//! Raises an exception if Width is less than zero.
//! Example:
//! before
//! me = "abcdef" , Width = 9 , Filler = ' '
//! after
//! me = "abcdef "
Standard_EXPORT void LeftJustify (const Standard_Integer Width, const Standard_Character Filler);
//! Returns number of characters in <me>.
//! This is the same functionality as 'strlen' in C.
//! Example
//! TCollection_AsciiString myAlphabet("abcdef");
//! assert ( myAlphabet.Length() == 6 );
//! - 1 is the position of the first character in this string.
//! - The length of this string gives the position of its last character.
//! - Positions less than or equal to zero, or
//! greater than the length of this string are
//! invalid in functions which identify a character
//! of this string by its position.
Standard_Integer Length() const;
//! Returns an index in the string <me> of the first occurence
//! of the string S in the string <me> from the starting index
//! FromIndex to the ending index ToIndex
//! returns zero if failure
//! Raises an exception if FromIndex or ToIndex is out of range.
//! Example:
//! before
//! me = "aabAaAa", S = "Aa", FromIndex = 1, ToIndex = 7
//! after
//! me = "aabAaAa"
//! returns
//! 4
Standard_EXPORT Standard_Integer Location (const TCollection_AsciiString& other, const Standard_Integer FromIndex, const Standard_Integer ToIndex) const;
//! Returns the index of the nth occurence of the character C
//! in the string <me> from the starting index FromIndex to the
//! ending index ToIndex.
//! Returns zero if failure.
//! Raises an exception if FromIndex or ToIndex is out of range.
//! Example:
//! before
//! me = "aabAa", N = 3, C = 'a', FromIndex = 1, ToIndex = 5
//! after
//! me = "aabAa"
//! returns
//! 5
Standard_EXPORT Standard_Integer Location (const Standard_Integer N, const Standard_Character C, const Standard_Integer FromIndex, const Standard_Integer ToIndex) const;
//! Converts <me> to its lower-case equivalent.
//! Example
//! TCollection_AsciiString myString("Hello Dolly");
//! myString.UpperCase();
//! assert ( myString == "HELLO DOLLY" );
//! myString.LowerCase();
//! assert ( myString == "hello dolly" );
Standard_EXPORT void LowerCase();
//! Inserts the string other at the beginning of this ASCII string.
//! Example
//! TCollection_AsciiString myAlphabet("cde");
//! TCollection_AsciiString myBegin("ab");
//! myAlphabet.Prepend(myBegin);
//! assert ( myAlphabet == "abcde" );
Standard_EXPORT void Prepend (const TCollection_AsciiString& other);
//! Displays <me> on a stream.
Standard_EXPORT void Print (Standard_OStream& astream) const;
friend Standard_EXPORT Standard_OStream& operator << (Standard_OStream& astream,const TCollection_AsciiString& astring);
//! Read <me> from a stream.
Standard_EXPORT void Read (Standard_IStream& astream);
friend Standard_EXPORT Standard_IStream& operator >> (Standard_IStream& astream, TCollection_AsciiString& astring);
//! Converts an AsciiString containing a numeric expression.
//! to a Real.
//! Example: ex: "215" returns 215.0.
//! ex: "3.14159267" returns 3.14159267.
Standard_EXPORT Standard_Real RealValue() const;
//! Remove all the occurences of the character C in the string.
//! Example:
//! before
//! me = "HellLLo", C = 'L' , CaseSensitive = True
//! after
//! me = "Hello"
Standard_EXPORT void RemoveAll (const Standard_Character C, const Standard_Boolean CaseSensitive);
//! Removes every <what> characters from <me>.
Standard_EXPORT void RemoveAll (const Standard_Character what);
//! Erases <ahowmany> characters from position <where>,
//! <where> included.
//! Example:
//! aString contains "Hello"
//! aString.Remove(2,2) erases 2 characters from position 2
//! This gives "Hlo".
Standard_EXPORT void Remove (const Standard_Integer where, const Standard_Integer ahowmany = 1);
//! Removes all space characters at the end of the string.
Standard_EXPORT void RightAdjust();
//! Right justify.
//! Length becomes equal to Width and the new characters are
//! equal to Filler.
//! if Width < Length nothing happens.
//! Raises an exception if Width is less than zero.
//! Example:
//! before
//! me = "abcdef" , Width = 9 , Filler = ' '
//! after
//! me = " abcdef"
Standard_EXPORT void RightJustify (const Standard_Integer Width, const Standard_Character Filler);
//! Searches a CString in <me> from the beginning
//! and returns position of first item <what> matching.
//! it returns -1 if not found.
//! Example:
//! aString contains "Sample single test"
//! aString.Search("le") returns 5
Standard_EXPORT Standard_Integer Search (const Standard_CString what) const;
//! Searches an AsciiString in <me> from the beginning
//! and returns position of first item <what> matching.
//! It returns -1 if not found.
Standard_EXPORT Standard_Integer Search (const TCollection_AsciiString& what) const;
//! Searches a CString in a AsciiString from the end
//! and returns position of first item <what> matching.
//! It returns -1 if not found.
//! Example:
//! aString contains "Sample single test"
//! aString.SearchFromEnd("le") returns 12
Standard_EXPORT Standard_Integer SearchFromEnd (const Standard_CString what) const;
//! Searches a AsciiString in another AsciiString from the end
//! and returns position of first item <what> matching.
//! It returns -1 if not found.
Standard_EXPORT Standard_Integer SearchFromEnd (const TCollection_AsciiString& what) const;
//! Replaces one character in the AsciiString at position <where>.
//! If <where> is less than zero or greater than the length of <me>
//! an exception is raised.
//! Example:
//! aString contains "Garbake"
//! astring.Replace(6,'g') gives <me> = "Garbage"
Standard_EXPORT void SetValue (const Standard_Integer where, const Standard_Character what);
//! Replaces a part of <me> by a CString.
//! If <where> is less than zero or greater than the length of <me>
//! an exception is raised.
//! Example:
//! aString contains "abcde"
//! aString.SetValue(4,"1234567") gives <me> = "abc1234567"
Standard_EXPORT void SetValue (const Standard_Integer where, const Standard_CString what);
//! Replaces a part of <me> by another AsciiString.
Standard_EXPORT void SetValue (const Standard_Integer where, const TCollection_AsciiString& what);
//! Splits a AsciiString into two sub-strings.
//! Example:
//! aString contains "abcdefg"
//! aString.Split(3) gives <me> = "abc" and returns "defg"
Standard_EXPORT TCollection_AsciiString Split (const Standard_Integer where);
//! Creation of a sub-string of the string <me>.
//! The sub-string starts to the index Fromindex and ends
//! to the index ToIndex.
//! Raises an exception if ToIndex or FromIndex is out of bounds
//! Example:
//! before
//! me = "abcdefg", ToIndex=3, FromIndex=6
//! after
//! me = "abcdefg"
//! returns
//! "cdef"
TCollection_AsciiString SubString (const Standard_Integer FromIndex, const Standard_Integer ToIndex) const;
//! Returns pointer to AsciiString (char *).
//! This is useful for some casual manipulations.
//! Warning: Because this "char *" is 'const', you can't modify its contents.
Standard_CString ToCString() const;
//! Extracts <whichone> token from <me>.
//! By default, the <separators> is set to space and tabulation.
//! By default, the token extracted is the first one (whichone = 1).
//! <separators> contains all separators you need.
//! If no token indexed by <whichone> is found, it returns empty AsciiString.
//! Example:
//! aString contains "This is a message"
//! aString.Token() returns "This"
//! aString.Token(" ",4) returns "message"
//! aString.Token(" ",2) returns "is"
//! aString.Token(" ",9) returns ""
//! Other separators than space character and tabulation are allowed :
//! aString contains "1234; test:message , value"
//! aString.Token("; :,",4) returns "value"
//! aString.Token("; :,",2) returns "test"
Standard_EXPORT TCollection_AsciiString Token (const Standard_CString separators = " \t", const Standard_Integer whichone = 1) const;
//! Truncates <me> to <ahowmany> characters.
//! Example: me = "Hello Dolly" -> Trunc(3) -> me = "Hel"
Standard_EXPORT void Trunc (const Standard_Integer ahowmany);
//! Converts <me> to its upper-case equivalent.
Standard_EXPORT void UpperCase();
//! Length of the string ignoring all spaces (' ') and the
//! control character at the end.
Standard_EXPORT Standard_Integer UsefullLength() const;
//! Returns character at position <where> in <me>.
//! If <where> is less than zero or greater than the lenght of <me>,
//! an exception is raised.
//! Example:
//! aString contains "Hello"
//! aString.Value(2) returns 'e'
Standard_EXPORT Standard_Character Value (const Standard_Integer where) const;
//! Hash function for AsciiString
//! (returns the same Integer value that the hash function for ExtendedString)
static Standard_Integer HashCode (const TCollection_AsciiString& astring, const Standard_Integer Upper);
//! Returns True when the two strings are the same.
//! (Just for HashCode for AsciiString)
static Standard_Boolean IsEqual (const TCollection_AsciiString& string1, const TCollection_AsciiString& string2);
//! Returns True when the two strings are the same.
//! (Just for HashCode for AsciiString)
static Standard_Boolean IsEqual (const TCollection_AsciiString& string1, const Standard_CString string2);
friend class TCollection_HAsciiString;
protected:
private:
Standard_EXPORT void Split (const Standard_Integer where, TCollection_AsciiString& result);
Standard_EXPORT void SubString (const Standard_Integer FromIndex, const Standard_Integer ToIndex, TCollection_AsciiString& result) const;
Standard_EXPORT void Token (const Standard_CString separators, const Standard_Integer whichone, TCollection_AsciiString& result) const;
Standard_PCharacter mystring;
Standard_Integer mylength;
};
#include <TCollection_AsciiString.lxx>
#endif // _TCollection_AsciiString_HeaderFile

View File

@@ -1,170 +0,0 @@
-- Created on: 1992-09-11
-- Created by: Mireille MERCIEN
-- Copyright (c) 1992-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class BaseSequence from TCollection
---Purpose: Definition of a base class for all instanciations
-- of sequence.
--
-- The methods : Clear, Remove accepts a pointer to a
-- function to use to delete the nodes. This allow
-- proper call of the destructor on the Items.
-- Without adding a virtual function pointer to each
-- node or each sequence.
raises
NoSuchObject from Standard,
OutOfRange from Standard
is
Create returns BaseSequence is protected;
---Purpose: Creation of an empty sequence.
Create(Other : BaseSequence) returns BaseSequence from TCollection
---Purpose: Creation by copy of existing Sequence.
-- Warning: This constructor prints a warning message.
-- We recommand to use the operator =.
is private;
IsEmpty(me) returns Boolean;
---Level: Public
---Purpose: returns True if the sequence <me> contains no elements.
---C++: inline
Length(me) returns Integer from Standard;
---Level: Public
---Purpose: Returns the number of element(s) in the
-- sequence. Returns zero if the sequence is empty.
---C++: inline
Clear(me : in out; DelNode : Address) is protected;
---Level: Private
PAppend(me : in out; Node : Address)
is protected;
PAppend(me : in out; S : in out BaseSequence)
---Level: Public
---Purpose: Concatenates <S> at the end of <me>.
-- <S> is cleared.
-- Example:
-- before
-- me = (A B C)
-- S = (D E F)
-- after
-- me = (A B C D E F)
-- S = ()
is protected;
PPrepend(me : in out; Node : Address)
is protected;
PPrepend(me : in out; S : in out BaseSequence)
---Level: Public
---Purpose: Concatenates <S> at the beginning of <me>.
-- <S> is cleared.
-- Example:
-- before
-- me = (A B C) S = (D E F)
-- after me = (D E F A B C)
-- S = ()
is protected;
Reverse(me : in out);
---Level: Public
---Purpose: Reverses the order of items on <me>.
-- Example:
-- before
-- me = (A B C)
-- after
-- me = (C B A)
PInsertAfter(me : in out; Index : Integer from Standard; Node : Address )
raises OutOfRange from Standard
is protected;
PInsertAfter(me : in out; Index : Integer from Standard; S : in out BaseSequence)
raises OutOfRange from Standard
---Level: Public
---Purpose: Inserts the sequence <S> in <me> after the
-- position <Index>. <S> is cleared.
-- Raises an exception if the index is out of bound.
-- Example:
-- before
-- me = (A B C), Index = 3, S = (D E F)
-- after
-- me = (A B C D E F)
-- S = ()
is protected;
Exchange(me : in out; I, J : Integer from Standard)
raises OutOfRange from Standard;
---Level: Public
---Purpose: Swaps elements which are located at
-- positions <I> and <J> in <me>.
-- Raises an exception if I or J is out of bound.
-- Example:
-- before
-- me = (A B C), I = 1, J = 3
-- after
-- me = (C B A)
PSplit(me : in out; Index : Integer from Standard; Sub : in out BaseSequence)
raises OutOfRange from Standard
---Level: Public
---Purpose: Keeps in <me> the items 1 to <Index>-1 and
-- puts in <Sub> the items <Index> to the end.
-- Example:
-- before
-- me = (A B C D) ,Index = 3
-- after
-- me = (A B)
-- Sub = (C D)
is protected;
Remove(me : in out; Index : Integer from Standard; DelNode : Address)
raises OutOfRange from Standard
is protected;
Remove(me : in out; FromIndex, ToIndex : Integer from Standard; DelNode : Address)
raises OutOfRange from Standard
is protected;
Find(me; Index : Integer from Standard) returns Address from Standard
---Level: Internal
---Purpose: Returns the node at position <index>.
is protected;
Nullify(me : in out ) is private;
---Level: Internal
---Purpose: Clear all fields.
--
fields
FirstItem : Address from Standard is protected;
LastItem : Address from Standard is protected;
CurrentItem : Address from Standard is protected;
CurrentIndex : Integer from Standard is protected;
Size : Integer from Standard is protected;
end;

View File

@@ -12,10 +12,11 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TCollection_BaseSequence.ixx>
#include <Standard_DomainError.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_DomainError.hxx>
#include <TCollection_BaseSequence.hxx>
#include <TCollection_SeqNode.hxx>
typedef void (*DelNode) (TCollection_SeqNode*);

View File

@@ -0,0 +1,167 @@
// Created on: 1992-09-11
// Created by: Mireille MERCIEN
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TCollection_BaseSequence_HeaderFile
#define _TCollection_BaseSequence_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Address.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
class Standard_NoSuchObject;
class Standard_OutOfRange;
//! Definition of a base class for all instanciations
//! of sequence.
//!
//! The methods : Clear, Remove accepts a pointer to a
//! function to use to delete the nodes. This allow
//! proper call of the destructor on the Items.
//! Without adding a virtual function pointer to each
//! node or each sequence.
class TCollection_BaseSequence
{
public:
DEFINE_STANDARD_ALLOC
//! returns True if the sequence <me> contains no elements.
Standard_Boolean IsEmpty() const;
//! Returns the number of element(s) in the
//! sequence. Returns zero if the sequence is empty.
Standard_Integer Length() const;
//! Reverses the order of items on <me>.
//! Example:
//! before
//! me = (A B C)
//! after
//! me = (C B A)
Standard_EXPORT void Reverse();
//! Swaps elements which are located at
//! positions <I> and <J> in <me>.
//! Raises an exception if I or J is out of bound.
//! Example:
//! before
//! me = (A B C), I = 1, J = 3
//! after
//! me = (C B A)
Standard_EXPORT void Exchange (const Standard_Integer I, const Standard_Integer J);
protected:
//! Creation of an empty sequence.
Standard_EXPORT TCollection_BaseSequence();
Standard_EXPORT void Clear (const Standard_Address DelNode);
Standard_EXPORT void PAppend (const Standard_Address Node);
//! Concatenates <S> at the end of <me>.
//! <S> is cleared.
//! Example:
//! before
//! me = (A B C)
//! S = (D E F)
//! after
//! me = (A B C D E F)
//! S = ()
Standard_EXPORT void PAppend (TCollection_BaseSequence& S);
Standard_EXPORT void PPrepend (const Standard_Address Node);
//! Concatenates <S> at the beginning of <me>.
//! <S> is cleared.
//! Example:
//! before
//! me = (A B C) S = (D E F)
//! after me = (D E F A B C)
//! S = ()
Standard_EXPORT void PPrepend (TCollection_BaseSequence& S);
Standard_EXPORT void PInsertAfter (const Standard_Integer Index, const Standard_Address Node);
//! Inserts the sequence <S> in <me> after the
//! position <Index>. <S> is cleared.
//! Raises an exception if the index is out of bound.
//! Example:
//! before
//! me = (A B C), Index = 3, S = (D E F)
//! after
//! me = (A B C D E F)
//! S = ()
Standard_EXPORT void PInsertAfter (const Standard_Integer Index, TCollection_BaseSequence& S);
//! Keeps in <me> the items 1 to <Index>-1 and
//! puts in <Sub> the items <Index> to the end.
//! Example:
//! before
//! me = (A B C D) ,Index = 3
//! after
//! me = (A B)
//! Sub = (C D)
Standard_EXPORT void PSplit (const Standard_Integer Index, TCollection_BaseSequence& Sub);
Standard_EXPORT void Remove (const Standard_Integer Index, const Standard_Address DelNode);
Standard_EXPORT void Remove (const Standard_Integer FromIndex, const Standard_Integer ToIndex, const Standard_Address DelNode);
//! Returns the node at position <index>.
Standard_EXPORT Standard_Address Find (const Standard_Integer Index) const;
Standard_Address FirstItem;
Standard_Address LastItem;
Standard_Address CurrentItem;
Standard_Integer CurrentIndex;
Standard_Integer Size;
private:
//! Creation by copy of existing Sequence.
//! Warning: This constructor prints a warning message.
//! We recommand to use the operator =.
Standard_EXPORT TCollection_BaseSequence(const TCollection_BaseSequence& Other);
//! Clear all fields.
Standard_EXPORT void Nullify();
};
#include <TCollection_BaseSequence.lxx>
#endif // _TCollection_BaseSequence_HeaderFile

View File

@@ -1,159 +0,0 @@
-- Created on: 1993-02-26
-- Created by: Remi LEQUETTE
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
private deferred class BasicMap from TCollection
---Purpose: Root class of all the maps, provides utilitites
-- for managing the buckets.
-- Maps are dynamically extended data structures where
-- data is quickly accessed with a key.
-- General properties of maps
-- - Map items may be (complex) non-unitary data; they
-- may be difficult to manage with an array. Moreover, the
-- map allows a data structure to be indexed by complex data.
-- - The size of a map is dynamically extended. So a map
-- may be first dimensioned for a little number of items.
-- Maps avoid the use of large and quasi-empty arrays.
-- - The access to a map item is much faster than the one
-- to a sequence, a list, a queue or a stack item.
-- - The access time to a map item may be compared with
-- the one to an array item. First of all, it depends on the
-- size of the map. It also depends on the quality of a user
-- redefinable function (the hashing function) to find
-- quickly where the item is.
-- - The exploration of a map may be of better performance
-- than the exploration of an array because the size of the
-- map is adapted to the number of inserted items.
-- These properties explain why maps are commonly used as
-- internal data structures for algorithms.
-- Definitions
-- - A map is a data structure for which data is addressed by keys.
-- - Once inserted in the map, a map item is referenced as an entry of the map.
-- - Each entry of the map is addressed by a key. Two
-- different keys address two different entries of the map.
-- - The position of an entry in the map is called a bucket.
-- - A map is dimensioned by its number of buckets, i.e. the
-- maximum number of entries in the map. The
-- performance of a map is conditioned by the number of buckets.
-- - The hashing function transforms a key into a bucket
-- index. The number of values that can be computed by
-- the hashing function is equal to the number of buckets of the map.
-- - Both the hashing function and the equality test
-- between two keys are provided by a hasher object.
-- - A map may be explored by a map iterator. This
-- exploration provides only inserted entries in the map
-- (i.e. non empty buckets).
-- Collections' generic maps
-- The Collections component provides numerous generic derived maps.
-- - These maps include automatic management of the
-- number of buckets: they are automatically resized when
-- the number of keys exceeds the number of buckets. If
-- you have a fair idea of the number of items in your map,
-- you can save on automatic resizing by specifying a
-- number of buckets at the time of construction, or by using
-- a resizing function. This may be considered for crucial optimization issues.
-- - Keys, items and hashers are parameters of these generic derived maps.
-- - TCollection_MapHasher class describes the
-- functions required by any hasher which is to be used
-- with a map instantiated from the Collections component.
-- - An iterator class is automatically instantiated at the
-- time of instantiation of a map provided by the
-- Collections component if this map is to be explored
-- with an iterator. Note that some provided generic maps
-- are not to be explored with an iterator but with indexes (indexed maps).
uses MapNodePtr from TCollection
is
Initialize(NbBuckets : Integer; single : Boolean);
---Purpose: Initialize the map. Single is True when the map
-- uses only one table of buckets.
--
-- One table : Map, DataMap
-- Two tables : DoubleMap, IndexedMap, IndexedDataMap
NbBuckets(me) returns Integer
---Purpose: Returns the number of buckets in <me>.
---C++: inline
is static;
Extent(me) returns Integer
---Purpose: Returns the number of keys already stored in <me>.
--
---C++: inline
is static;
IsEmpty(me) returns Boolean
---Purpose: Returns True when the map contains no keys.
-- This is exactly Extent() == 0.
---C++: inline
is static;
BeginResize(me;
NbBuckets : Integer;
NewBuckets : out Integer;
data1, data2 : out Address)
returns Boolean
---Purpose: Tries to resize the Map with NbBuckets. Returns
-- True if possible, NewBuckts is the new nuber of
-- buckets. data1 and data2 are the new tables of
-- buckets where the data must be copied.
is static protected;
EndResize(me : in out;
NbBuckets : Integer;
NewBuckets : Integer;
data1, data2 : Address)
---Purpose: If BeginResize was succesfull after copying the
-- data to data1 and data2 this methods update the
-- tables and destroys the old ones.
is static protected;
Resizable(me) returns Boolean
---Purpose: Returns True if resizing the map should be
-- considered.
---C++: inline
is static protected;
Increment(me : in out)
---Purpose: Decrement the extent of the map.
---C++: inline
is static protected;
Decrement(me : in out)
---Purpose: Decrement the extent of the map.
---C++: inline
is static protected;
Destroy(me : in out)
---Purpose: Destroys the buckets.
is static protected;
Statistics(me; S : in out OStream)
---Purpose: Prints on <S> usefull statistics about the map
-- <me>. It can be used to test the quality of the hashcoding.
is static;
fields
isDouble : Boolean from Standard; -- True for double maps
mySaturated : Boolean from Standard;
myNbBuckets : Integer;
mySize : Integer;
myData1 : Address from Standard is protected;
myData2 : Address from Standard is protected;
friends
class BasicMapIterator from TCollection
end BasicMap;

View File

@@ -14,17 +14,17 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TCollection_BasicMap.ixx>
#include <Standard_Stream.hxx>
#include <TCollection.hxx>
#include <TCollection_BasicMap.hxx>
#include <TCollection_BasicMapIterator.hxx>
#include <TCollection_MapNode.hxx>
#include <Standard_Stream.hxx>
//=======================================================================
//function : TCollection_BasicMap
//purpose :
//=======================================================================
TCollection_BasicMap::TCollection_BasicMap(const Standard_Integer NbBuckets,
const Standard_Boolean single) :
myData1(NULL),

View File

@@ -0,0 +1,172 @@
// Created on: 1993-02-26
// Created by: Remi LEQUETTE
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TCollection_BasicMap_HeaderFile
#define _TCollection_BasicMap_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Address.hxx>
#include <Standard_OStream.hxx>
class TCollection_BasicMapIterator;
//! Root class of all the maps, provides utilitites
//! for managing the buckets.
//! Maps are dynamically extended data structures where
//! data is quickly accessed with a key.
//! General properties of maps
//! - Map items may be (complex) non-unitary data; they
//! may be difficult to manage with an array. Moreover, the
//! map allows a data structure to be indexed by complex data.
//! - The size of a map is dynamically extended. So a map
//! may be first dimensioned for a little number of items.
//! Maps avoid the use of large and quasi-empty arrays.
//! - The access to a map item is much faster than the one
//! to a sequence, a list, a queue or a stack item.
//! - The access time to a map item may be compared with
//! the one to an array item. First of all, it depends on the
//! size of the map. It also depends on the quality of a user
//! redefinable function (the hashing function) to find
//! quickly where the item is.
//! - The exploration of a map may be of better performance
//! than the exploration of an array because the size of the
//! map is adapted to the number of inserted items.
//! These properties explain why maps are commonly used as
//! internal data structures for algorithms.
//! Definitions
//! - A map is a data structure for which data is addressed by keys.
//! - Once inserted in the map, a map item is referenced as an entry of the map.
//! - Each entry of the map is addressed by a key. Two
//! different keys address two different entries of the map.
//! - The position of an entry in the map is called a bucket.
//! - A map is dimensioned by its number of buckets, i.e. the
//! maximum number of entries in the map. The
//! performance of a map is conditioned by the number of buckets.
//! - The hashing function transforms a key into a bucket
//! index. The number of values that can be computed by
//! the hashing function is equal to the number of buckets of the map.
//! - Both the hashing function and the equality test
//! between two keys are provided by a hasher object.
//! - A map may be explored by a map iterator. This
//! exploration provides only inserted entries in the map
//! (i.e. non empty buckets).
//! Collections' generic maps
//! The Collections component provides numerous generic derived maps.
//! - These maps include automatic management of the
//! number of buckets: they are automatically resized when
//! the number of keys exceeds the number of buckets. If
//! you have a fair idea of the number of items in your map,
//! you can save on automatic resizing by specifying a
//! number of buckets at the time of construction, or by using
//! a resizing function. This may be considered for crucial optimization issues.
//! - Keys, items and hashers are parameters of these generic derived maps.
//! - TCollection_MapHasher class describes the
//! functions required by any hasher which is to be used
//! with a map instantiated from the Collections component.
//! - An iterator class is automatically instantiated at the
//! time of instantiation of a map provided by the
//! Collections component if this map is to be explored
//! with an iterator. Note that some provided generic maps
//! are not to be explored with an iterator but with indexes (indexed maps).
class TCollection_BasicMap
{
public:
DEFINE_STANDARD_ALLOC
//! Returns the number of buckets in <me>.
Standard_Integer NbBuckets() const;
//! Returns the number of keys already stored in <me>.
Standard_Integer Extent() const;
//! Returns True when the map contains no keys.
//! This is exactly Extent() == 0.
Standard_Boolean IsEmpty() const;
//! Prints on <S> usefull statistics about the map
//! <me>. It can be used to test the quality of the hashcoding.
Standard_EXPORT void Statistics (Standard_OStream& S) const;
friend class TCollection_BasicMapIterator;
protected:
//! Initialize the map. Single is True when the map
//! uses only one table of buckets.
//!
//! One table : Map, DataMap
//! Two tables : DoubleMap, IndexedMap, IndexedDataMap
Standard_EXPORT TCollection_BasicMap(const Standard_Integer NbBuckets, const Standard_Boolean single);
//! Tries to resize the Map with NbBuckets. Returns
//! True if possible, NewBuckts is the new nuber of
//! buckets. data1 and data2 are the new tables of
//! buckets where the data must be copied.
Standard_EXPORT Standard_Boolean BeginResize (const Standard_Integer NbBuckets, Standard_Integer& NewBuckets, Standard_Address& data1, Standard_Address& data2) const;
//! If BeginResize was succesfull after copying the
//! data to data1 and data2 this methods update the
//! tables and destroys the old ones.
Standard_EXPORT void EndResize (const Standard_Integer NbBuckets, const Standard_Integer NewBuckets, const Standard_Address data1, const Standard_Address data2);
//! Returns True if resizing the map should be
//! considered.
Standard_Boolean Resizable() const;
//! Decrement the extent of the map.
void Increment();
//! Decrement the extent of the map.
void Decrement();
//! Destroys the buckets.
Standard_EXPORT void Destroy();
Standard_Address myData1;
Standard_Address myData2;
private:
Standard_Boolean isDouble;
Standard_Boolean mySaturated;
Standard_Integer myNbBuckets;
Standard_Integer mySize;
};
#include <TCollection_BasicMap.lxx>
#endif // _TCollection_BasicMap_HeaderFile

View File

@@ -1,82 +0,0 @@
-- Created on: 1993-02-26
-- Created by: Remi LEQUETTE
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
private deferred class BasicMapIterator from TCollection
---Purpose: This class provides basic services for the
-- iterators on Maps. The iterators are inherited
-- from this one.
--
-- The iterator contains an array of pointers
-- (buckets). Each bucket is a pointer on a node. A
-- node contains a pointer on the next node.
--
-- This class provides also basic services for the
-- implementation of Maps.
-- A map iterator provides a step by step exploration of all
-- entries of a map. After initialization of a concrete derived
-- iterator, use in a loop:
-- - the function More to know if there is a current entry for
-- the iterator in the map,
-- - then the functions which read data on an entry of the
-- map (these functions are provided by each type of map),
-- - then the function Next to set the iterator to the next entry of the map.
-- Warning
-- - A map is a non-ordered data structure. The order in
-- which entries of a map are explored by the iterator
-- depends on its contents, and change when the map is edited.
-- - It is not recommended to modify the contents of a map
-- during iteration: the result is unpredictable.
uses
BasicMap from TCollection
is
Initialize;
---Purpose: Creates an empty iterator.
Initialize(M : BasicMap from TCollection);
---Purpose: Initialize on the first node in the buckets.
Initialize(me : in out; M : BasicMap from TCollection)
---Purpose: Initialize on the first node in the buckets.
is static protected;
Reset(me : in out)
---Purpose: Resets the iterator to the first node.
is static;
More(me) returns Boolean
---Purpose: Returns true if there is a current entry for this iterator in the map.
-- Use the function Next to set this iterator to the position of
-- the next entry, if it exists.
---C++: inline
is static;
Next(me : in out)
---Purpose: Sets this iterator to the position of the next entry of the map.
-- Nothing is changed if there is no more entry to explore in
-- the map: this iterator is always positioned on the last entry
-- of the map but the function More returns false.
is static;
fields
myNbBuckets : Integer;
myBuckets : Address from Standard;
myBucket : Integer;
myNode : Address from Standard is protected;
end BasicMapIterator;

View File

@@ -14,15 +14,15 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TCollection_BasicMapIterator.ixx>
#include <TCollection_BasicMap.hxx>
#include <TCollection_BasicMapIterator.hxx>
#include <TCollection_MapNode.hxx>
//=======================================================================
//function : TCollection_BasicMapIterator
//purpose :
//=======================================================================
TCollection_BasicMapIterator::TCollection_BasicMapIterator () :
myNode(NULL),
myNbBuckets(0),

View File

@@ -0,0 +1,112 @@
// Created on: 1993-02-26
// Created by: Remi LEQUETTE
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TCollection_BasicMapIterator_HeaderFile
#define _TCollection_BasicMapIterator_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Address.hxx>
#include <Standard_Boolean.hxx>
class TCollection_BasicMap;
//! This class provides basic services for the
//! iterators on Maps. The iterators are inherited
//! from this one.
//!
//! The iterator contains an array of pointers
//! (buckets). Each bucket is a pointer on a node. A
//! node contains a pointer on the next node.
//!
//! This class provides also basic services for the
//! implementation of Maps.
//! A map iterator provides a step by step exploration of all
//! entries of a map. After initialization of a concrete derived
//! iterator, use in a loop:
//! - the function More to know if there is a current entry for
//! the iterator in the map,
//! - then the functions which read data on an entry of the
//! map (these functions are provided by each type of map),
//! - then the function Next to set the iterator to the next entry of the map.
//! Warning
//! - A map is a non-ordered data structure. The order in
//! which entries of a map are explored by the iterator
//! depends on its contents, and change when the map is edited.
//! - It is not recommended to modify the contents of a map
//! during iteration: the result is unpredictable.
class TCollection_BasicMapIterator
{
public:
DEFINE_STANDARD_ALLOC
//! Resets the iterator to the first node.
Standard_EXPORT void Reset();
//! Returns true if there is a current entry for this iterator in the map.
//! Use the function Next to set this iterator to the position of
//! the next entry, if it exists.
Standard_Boolean More() const;
//! Sets this iterator to the position of the next entry of the map.
//! Nothing is changed if there is no more entry to explore in
//! the map: this iterator is always positioned on the last entry
//! of the map but the function More returns false.
Standard_EXPORT void Next();
protected:
//! Creates an empty iterator.
Standard_EXPORT TCollection_BasicMapIterator();
//! Initialize on the first node in the buckets.
Standard_EXPORT TCollection_BasicMapIterator(const TCollection_BasicMap& M);
//! Initialize on the first node in the buckets.
Standard_EXPORT void Initialize (const TCollection_BasicMap& M);
Standard_Address myNode;
private:
Standard_Integer myNbBuckets;
Standard_Address myBuckets;
Standard_Integer myBucket;
};
#include <TCollection_BasicMapIterator.lxx>
#endif // _TCollection_BasicMapIterator_HeaderFile

View File

@@ -1,214 +0,0 @@
-- Created on: 1993-01-08
-- Created by: Remi LEQUETTE
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class DataMap from TCollection
(TheKey as any;
TheItem as any;
Hasher as any) -- as MapHasher(TheKey)
inherits BasicMap from TCollection
---Purpose: The DataMap is a Map to store keys with associated
-- Items.An entry of a DataMap is composed of both the key and the item.
-- The DataMap can be seen as an extended array where
-- the Keys are the indices. For this reason the
-- operator () is defined on DataMap to fetch an Item
-- from a Key. So the following syntax can be used :
--
-- anItem = aMap(aKey);
-- aMap(aKey) = anItem;
--
-- This analogy has its limit. aMap(aKey) = anItem
-- can be done only if aKey was previously bound to
-- an item in the map.
-- DataMap is a generic class which depends on three parameters:
-- - Key is the type of key for an entry in the map,
-- - Item is the type of element associated with a key in the map,
-- - Hasher is the type of hasher on keys.
-- Use a DataMapIterator iterator to explore a DataMap map.
-- Notes:
-- - An iterator class is automatically instantiated from the
-- TCollection_DataMapIterator generic class at the
-- time of instantiation of a DataMap map.
-- - TCollection_MapHasher class describes the
-- functions required for a Hasher object.
raises
DomainError from Standard,
NoSuchObject from Standard
class DataMapNode from TCollection
inherits MapNode from TCollection
uses MapNodePtr from TCollection
is
Create(K : TheKey; I : TheItem; n : MapNodePtr from TCollection) returns DataMapNode from TCollection;
--- Purpose: Constructs a DataMap with NbBuckets (defaulted to 1) buckets.
-- Note that the map will be automatically redimensioned
-- during its use if the number of entries becomes too large.
-- Use:
-- - the function Bind to add an entry (key, item) in the map,
-- - operator() to read an item from a key, or to assign a
-- new value to this item,
-- - the function UnBind to remove an entry (key, item) from the map,
-- - and a map iterator to explore the map.
---C++: inline
Key(me) returns TheKey;
---C++: return &
---C++: inline
Value(me) returns TheItem;
---C++: return &
---C++: inline
fields
myKey : TheKey;
myValue : TheItem;
end;
class DataMapIterator inherits BasicMapIterator from TCollection
---Purpose: Functions used for iterating the contents of a DataMap
-- Note: an iterator class is automatically instantiated from
-- this generic class at the time of instantiation of a DataMap.
-- Warning
-- - A map is a non-ordered data structure. The order in
-- which entries of a map are explored by the iterator
-- depends on its contents, and change when the map is edited.
-- - It is not recommended to modify the contents of a map
-- during iteration: the result is unpredictable.
raises NoSuchObject from Standard
is
Create returns DataMapIterator from TCollection;
---Purpose: Creates an undefined Iterator (empty); use the function Initialize to define the map to explore.
Create (aMap : DataMap from TCollection)
returns DataMapIterator from TCollection;
---Purpose: Creates an Iterator on the map <aMap>.
Initialize(me : in out; aMap : DataMap from TCollection)
---Level: Public
---Purpose: Sets, or resets the Iterator in the map <aMap>.
is static;
Key(me) returns any TheKey
---Purpose: Returns the current Key. An error is raised if
-- the iterator is empty (More returns False).
-- Note: Key is the type of key for an entry in the explored DataMap map.
-- Exceptions
-- Standard_NoSuchObject if this iterator is empty (i.e.
-- when the function More returns false).
---C++: return const &
raises
NoSuchObject from Standard
is static;
Value(me) returns any TheItem
---Purpose: Returns the item of the current entry in the map for this iterator.
-- Note: Item is the type of element bound to a key in the explored DataMap map.
-- Exceptions
-- Standard_NoSuchObject if this iterator is empty (i.e.
-- when the function More returns false)
---C++: return const &
raises
NoSuchObject from Standard
is static;
end DataMapIterator from TCollection;
is
Create(NbBuckets : Integer = 1) returns DataMap from TCollection;
---Purpose: Creates a DataMap with <NbBuckets> buckets. Without
-- arguments the map is automatically dimensioned.
Create(Other : DataMap from TCollection) returns DataMap from TCollection
---Purpose: As copying Map is an expensive operation it is
-- incorrect to do it implicitly. This constructor is private and
-- will raise an error if the Map is not empty.
-- To copy the content of a DataMap use the Assign method (operator =).
raises DomainError from Standard
is private;
Assign(me : in out; Other : DataMap from TCollection)
returns DataMap from TCollection
---Purpose: Copies the contents of the map Other into this map.
-- Note that this method is an alias of operator =.
---C++: alias operator =
---C++: return &
is static;
ReSize(me : in out; NbBuckets : Integer)
---Level: Public
---Purpose: Changes the number of buckets of <me> to be
-- <NbBuckets>. The keys already stored in the map are kept.
is static;
Clear(me : in out)
---Purpose: Removes all keys in the map.
---C++: alias ~
is static;
Bind(me : in out; K : TheKey; I : TheItem) returns Boolean
---Purpose: Adds the Key <K> to the Map <me> with the Item
-- <I>. Returns True if the Key was not already in
-- the Map. If the Key was already in the Map the
-- Item in the Map is replaced.
is static;
IsBound(me; K : TheKey) returns Boolean
---Purpose: Returns True if the key <K> is stored in the map <me>.
is static;
UnBind(me : in out; K : TheKey) returns Boolean
---Purpose: Removes the Key <K> from the map. Returns True if
-- the Key was in the Map.
-- Returns false if the key K was not in this map.
is static;
Find(me; K : TheKey) returns any TheItem
---Level: Public
---Purpose: Returns the Item stored with the Key <K> in the Map.
-- Trigger: An exception is raised when <K> is not in the map.
raises NoSuchObject from Standard
---C++: alias operator()
---C++: return const &
is static;
ChangeFind(me : in out; K : TheKey) returns any TheItem
---Level: Public
---Purpose: Returns the Item stored with the Key <K> in the
-- Map. This Item can be modified with the syntax
-- aMap(K) = newItem;
-- Trigger: An exception is raised when <K> is not in the map.
---C++: alias operator()
---C++: return &
raises NoSuchObject from Standard
is static;
--modified by NIZNHY-PKV Tue Jul 05 09:57:10 2011f
Find1(me; K : TheKey)
returns Address from Standard;
---Purpose: Returns the address of Item of the key <K>
-- or NULL if K is not in the map.
ChangeFind1(me:out; K : TheKey)
returns Address from Standard;
---Purpose: Returns the address of Item of the key <K>
-- or NULL if K is not in the map.
--modified by NIZNHY-PKV Tue Jul 05 09:57:14 2011t
end DataMap;

View File

@@ -1,210 +0,0 @@
-- Created on: 1993-01-08
-- Created by: Remi LEQUETTE
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class DoubleMap from TCollection (TheKey1 as any;
TheKey2 as any;
Hasher1 as any; -- as MapHasher(TheKey1)
Hasher2 as any) -- as MapHasher(TheKey2)
inherits BasicMap from TCollection
---Purpose:
-- A map used to bind pairs of keys (Key1,Key2) and
-- retrieve them in linear time. Key1 is referenced as the
-- first key of the DoubleMap and Key2 as the second key.
-- An entry of a DoubleMap is composed of a pair of two
-- keys: the first key and the second key.
-- DoubleMap is a generic class which depends on four parameters:
-- - Key1 is the type of the first key for an entry in the map,
-- - Key2 is the type of the second key for an entry in the map,
-- - Hasher1 is the type of hasher on first keys,
-- - Hasher2 is the type of hasher on second keys.
-- Use a DoubleMapIterator to explore a DoubleMap map.
-- Notes:
-- - An iterator class is automatically instantiated from the
-- TCollection_DoubleMapIterator class at the time of
-- instantiation of a DoubleMap map.
-- - TCollection_MapHasher class describes the
-- functions required for a Hasher1 or a Hasher2 object.
raises
DomainError from Standard,
MultiplyDefined from Standard,
NoSuchObject from Standard
class DoubleMapNode from TCollection
inherits MapNode from TCollection
uses MapNodePtr from TCollection
is
Create(K1 : TheKey1; K2 : TheKey2; n1,n2 : MapNodePtr from TCollection) returns DoubleMapNode from TCollection;
---C++: inline
Key1(me) returns TheKey1;
---C++: return &
---C++: inline
Key2(me) returns TheKey2;
---C++: return &
---C++: inline
Next2(me) returns MapNodePtr from TCollection;
---C++: return &
---C++: inline
fields
myKey1 : TheKey1;
myKey2 : TheKey2;
myNext2 : MapNodePtr from TCollection;
end;
class DoubleMapIterator inherits BasicMapIterator from TCollection
---Purpose: Functions used for iterating the contents of a DoubleMap map.
-- Note: an iterator class is automatically instantiated from
-- this generic class at the time of instantiation of a DoubleMap map.
-- Warning
-- - A map is a non-ordered data structure. The order in
-- which entries of a map are explored by the iterator
-- depends on its contents, and changes when the map is edited.
-- - It is not recommended to modify the contents of a map
-- during iteration: the result is unpredictable.
raises NoSuchObject from Standard
is
Create returns DoubleMapIterator from TCollection;
---Purpose: Creates an undefined Iterator (empty) use the
--- function Initialize to define the map to explore.
Create (aMap : DoubleMap from TCollection)
returns DoubleMapIterator from TCollection;
---Purpose: Creates an Iterator on the map <aMap>.
Initialize(me : in out; aMap : DoubleMap from TCollection)
---Level: Public
---Purpose: Sets or resets the Iterator in the map <aMap>.
is static;
Key1(me) returns any TheKey1
---Purpose: Returns the first key, of the current
-- entry in the map for this iterator.
-- Note: Key1 and Key2 are the types of the first and second
-- keys for an entry in the explored DoubleMap map.
-- Exceptions
-- Standard_NoSuchObject if this iterator is empty (i.e.
-- when the function More returns false).
---C++: return const &
raises
NoSuchObject from Standard
is static;
Key2(me) returns any TheKey2
---Purpose: Returns the second key, of the current
-- entry in the map for this iterator.
-- Note: Key1 and Key2 are the types of the first and second
-- keys for an entry in the explored DoubleMap map.
-- Exceptions
-- Standard_NoSuchObject if this iterator is empty (i.e.
-- when the function More returns false).
---C++: return const &
raises
NoSuchObject from Standard
is static;
end DoubleMapIterator from TCollection;
is
Create(NbBuckets : Integer = 1) returns DoubleMap from TCollection;
---Purpose: Creates a DoubleMap with <NbBuckets> buckets. Without
-- arguments the map is automatically dimensioned.
Create(Other : DoubleMap from TCollection)
returns DoubleMap from TCollection
---Purpose: As copying Map is an expensive operation it is
-- incorrect to do it implicitly. This constructor is private and
-- will raise an error if the Map is not empty. To copy the
-- content of a Map use the Assign method (operator =).
raises DomainError from Standard
is private;
Assign(me : in out; Other : DoubleMap from TCollection)
returns DoubleMap from TCollection
---Purpose: Copies the contents of the map Other into this map.
-- Note that this method is an alias of operator =.
---C++: alias operator =
---C++: return &
is static;
ReSize(me : in out; NbBuckets : Integer)
---Purpose: Changes the number of buckets of this map to N.
-- The entries (Key1 + Key2) already stored in this map are maintained.
is static;
Clear(me : in out)
---Level: Public
---Purpose: Removes all keys from the map.
---C++: alias ~
is static;
Bind(me : in out; K1 : TheKey1; K2 : TheKey2)
---Level: Public
---Purpose: Adds the pair <K1>,<K2> to the map.
-- Trigger: An exception is raised if K1 or K2 are already bound.
raises MultiplyDefined from Standard
is static;
AreBound(me; K1 : TheKey1; K2 : TheKey2) returns Boolean
---Level: Public
---Purpose: Returns True if <K1> and <K2> are bound to each other in the map <me>.
is static;
IsBound1(me; K : TheKey1) returns Boolean
---Level: Public
---Purpose: Returns True if the TheKey <K> is bound in the map <me>.
is static;
IsBound2(me; K : TheKey2) returns Boolean
---Level: Public
---Purpose: Returns True if the key <K> is bound in the map <me>.
is static;
Find1(me; K : TheKey1) returns any TheKey2
---Level: Public
---Purpose: Returns the Key2 bound to <K> in the map.
---C++: return const &
raises NoSuchObject
is static;
Find2(me; K : TheKey2) returns any TheKey1
---Level: Public
---Purpose: Returns the Key1 bound to <K> in the map.
---C++: return const &
raises NoSuchObject
is static;
UnBind1(me : in out; K : TheKey1) returns Boolean
---Level: Public
---Purpose: Unbind the Key <K> from the map. Returns True if
-- the Key was bound in the Map.
is static;
UnBind2(me : in out; K : TheKey2) returns Boolean
---Level: Public
---Purpose: Unbind the Key <K> from the map. Returns True if
-- the Key was bound in the Map.
is static;
end DoubleMap;

View File

@@ -1,389 +0,0 @@
-- Created on: 1993-02-22
-- Created by: Mireille MERCIEN
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class ExtendedString from TCollection
---Purpose: A variable-length sequence of "extended"
-- (UNICODE) characters (16-bit character type). It
-- provides editing operations with built-in memory
-- management to make ExtendedString objects
-- easier to use than ordinary extended character arrays.
-- ExtendedString objects follow "value
-- semantics", that is, they are the actual strings,
-- not handles to strings, and are copied through
-- assignment. You may use HExtendedString
-- objects to get handles to strings.
uses AsciiString from TCollection
raises
NullObject,
OutOfRange,
NumericError,
NegativeValue
is
Create returns ExtendedString from TCollection;
---Purpose: Initializes a ExtendedString to an empty ExtendedString.
Create( astring : CString; isMultiByte : Boolean = Standard_False)
returns ExtendedString from TCollection
raises NullObject;
---Purpose: Creation by converting a CString to an extended
-- string. If <isMultiByte> is true then the string is
-- treated as having UTF-8 coding. If it is not a UTF-8
-- then <isMultiByte> is ignored and each character is
-- copied to ExtCharacter.
Create( astring : ExtString)
returns ExtendedString from TCollection
raises NullObject;
---Purpose: Creation by converting an ExtString to an extended string.
Create ( aChar : Character) returns ExtendedString from TCollection;
---Purpose: Initializes a AsciiString with a single character.
Create ( aChar : ExtCharacter) returns ExtendedString from TCollection;
---Purpose: Initializes a ExtendedString with a single character.
Create ( length : Integer; filler : ExtCharacter)
returns ExtendedString from TCollection;
---Purpose: Initializes a ExtendedString with <length> space allocated.
-- and filled with <filler>.This is useful for buffers.
Create ( value : Integer ) returns ExtendedString from TCollection
---Purpose: Initializes an ExtendedString with an integer value
raises NullObject;
Create ( value : Real ) returns ExtendedString from TCollection
---Purpose: Initializes an ExtendedString with a real value
raises NullObject;
Create ( astring : ExtendedString from TCollection )
returns ExtendedString from TCollection;
---Purpose: Initializes a ExtendedString with another ExtendedString.
Create( astring : AsciiString from TCollection)
returns ExtendedString from TCollection;
---Purpose: Creation by converting an Ascii string to an extended
-- string. The string is treated as having UTF-8 coding.
-- If it is not a UTF-8 then each character is copied to ExtCharacter.
AssignCat (me : out ; other : ExtendedString from TCollection)
is static;
---Purpose: Appends the other extended string to this extended string.
-- Note that this method is an alias of operator +=.
-- Example: aString += anotherString
---C++: alias operator +=
Cat (me ; other : ExtendedString from TCollection)
returns ExtendedString from TCollection
is static;
---Level: Public
---Purpose: Appends <other> to me.
---Example: aString = aString + anotherString
---C++: alias operator +
ChangeAll(me : out; aChar, NewChar : ExtCharacter)
is static;
---Level: Public
---Purpose: Substitutes all the characters equal to aChar by NewChar
-- in the ExtendedString <me>.
-- The substitution can be case sensitive.
-- If you don't use default case sensitive, no matter wether aChar
-- is uppercase or not.
---Example:
-- me = "Histake" -> ChangeAll('H','M',Standard_True)
-- gives me = "Mistake"
Clear (me : out)
is static;
---Level: Public
---Purpose: Removes all characters contained in <me>.
-- This produces an empty ExtendedString.
Copy (me : out ; fromwhere : ExtendedString from TCollection)
is static;
---Level: Public
---Purpose: Copy <fromwhere> to <me>.
-- Used as operator =
---Example: aString = anotherString;
---C++: alias operator =
Destroy (me : in out)
is static;
---Level: Public
---Purpose: Frees memory allocated by ExtendedString.
---C++: alias ~
Insert (me : out; where : Integer; what : ExtCharacter)
---Level: Public
---Purpose: Insert a Character at position <where>.
---Example:
-- aString contains "hy not ?"
-- aString.Insert(1,'W'); gives "Why not ?"
-- aString contains "Wh"
-- aString.Insert(3,'y'); gives "Why"
-- aString contains "Way"
-- aString.Insert(2,'h'); gives "Why"
raises OutOfRange from Standard
is static;
Insert (me : out; where : Integer; what : ExtendedString from TCollection)
---Level: Public
---Purpose: Insert a ExtendedString at position <where>.
raises OutOfRange from Standard
is static;
IsEmpty(me) returns Boolean from Standard
is static;
---Level: Public
---C++: inline
---Purpose: Returns True if this string contains no characters.
IsEqual (me ; other : ExtString )
returns Boolean from Standard
is static;
---Level: Public
---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++: alias operator ==
IsEqual (me ; other : ExtendedString from TCollection)
returns Boolean from Standard
is static;
---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++: alias operator ==
IsDifferent (me ; other : ExtString )
returns Boolean from Standard
is static;
---Purpose: Returns true if there are differences between the
-- characters in this extended string and the other extended string.
-- Note that this method is an alias of operator !=.
---C++: alias operator !=
IsDifferent (me ; other : ExtendedString from TCollection)
returns Boolean from Standard
is static;
---Purpose: Returns true if there are differences between the
-- characters in this extended string and the other extended string.
-- Note that this method is an alias of operator !=.
---C++: alias operator !=
IsLess (me ; other : ExtString )
returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns TRUE if <me> is less than <other>.
---C++: alias operator <
IsLess (me ; other : ExtendedString from TCollection)
returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns TRUE if <me> is less than <other>.
---C++: alias operator <
IsGreater (me ; other : ExtString )
returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns TRUE if <me> is greater than <other>.
---C++: alias operator >
IsGreater (me ; other : ExtendedString from TCollection)
returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns TRUE if <me> is greater than <other>.
---C++: alias operator >
IsAscii(me)
returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns True if the ExtendedString contains only
-- "Ascii Range" characters .
Length (me) returns Integer from Standard
is static;
---Level: Public
---Purpose: Returns number of characters in <me>.
-- This is the same functionality as 'strlen' in C.
Print (me ; astream : out OStream)
is static;
---Level: Public
---Purpose: Displays <me> .
---C++: alias "friend Standard_EXPORT Standard_OStream& operator << (Standard_OStream& astream,const TCollection_ExtendedString& astring);"
RemoveAll(me : out; what : ExtCharacter)
is static;
---Level: Public
---Purpose: Removes every <what> characters from <me>.
Remove (me : out ; where : Integer ; ahowmany : Integer=1)
---Level: Public
---Purpose: Erases <ahowmany> characters from position <where>,<where> included.
---Example:
-- aString contains "Hello"
-- aString.Erase(2,2) erases 2 characters from position 1
-- This gives "Hlo".
raises OutOfRange from Standard
is static;
Search (me ; what : ExtendedString from TCollection)
returns Integer from Standard
is static;
---Level: Public
---Purpose: Searches a ExtendedString in <me> from the beginning
-- and returns position of first item <what> matching.
-- it returns -1 if not found.
SearchFromEnd (me ; what : ExtendedString from TCollection)
returns Integer from Standard
is static;
---Level: Public
---Purpose: Searches a ExtendedString in another ExtendedString from the
-- end and returns position of first item <what> matching.
-- it returns -1 if not found.
SetValue(me : out; where : Integer; what : ExtCharacter)
---Level: Public
---Purpose: Replaces one character in the ExtendedString at position <where>.
-- If <where> is less than zero or greater than the length of <me>
-- an exception is raised.
---Example:
-- aString contains "Garbake"
-- astring.Replace(6,'g') gives <me> = "Garbage"
raises OutOfRange from Standard
is static;
SetValue(me : out; where : Integer; what : ExtendedString from TCollection)
---Level: Public
---Purpose: Replaces a part of <me> by another ExtendedString see above.
raises OutOfRange from Standard
is static;
Split(me : out; where : Integer) returns ExtendedString from TCollection
---Purpose: Splits this extended string into two sub-strings at position where.
-- - The second sub-string (from position
-- where + 1 of this string to the end) is
-- returned in a new extended string.
-- - this extended string is modified: its last
-- characters are removed, it becomes equal to
-- the first sub-string (from the first character to position where).
-- Example:
-- aString contains "abcdefg"
-- aString.Split(3) gives <me> = "abc" and returns "defg"
raises OutOfRange from Standard
is static;
Token (me ; separators : ExtString; whichone : Integer=1)
returns ExtendedString from TCollection
---Purpose: Extracts <whichone> token from <me>.
-- By default, the <separators> is set to space and tabulation.
-- By default, the token extracted is the first one (whichone = 1).
-- <separators> contains all separators you need.
-- If no token indexed by <whichone> is found, it returns an empty AsciiString.
-- Example:
-- aString contains "This is a message"
-- aString.Token() returns "This"
-- aString.Token(" ",4) returns "message"
-- aString.Token(" ",2) returns "is"
-- aString.Token(" ",9) returns ""
-- Other separators than space character and tabulation are allowed :
-- aString contains "1234; test:message , value"
-- aString.Token("; :,",4) returns "value"
-- aString.Token("; :,",2) returns "test"
raises NullObject from Standard
is static;
ToExtString(me) returns ExtString
---Level: Public
---Purpose: Returns pointer to ExtString
---C++: return const
is static;
Trunc (me : out ; ahowmany : Integer)
---Purpose: Truncates <me> to <ahowmany> characters.
-- Example: me = "Hello Dolly" -> Trunc(3) -> me = "Hel"
-- Exceptions
-- Standard_OutOfRange if ahowmany is greater
-- than the length of this string.
raises OutOfRange from Standard
is static;
Value(me ; where : Integer) returns ExtCharacter
---Purpose: Returns character at position <where> in <me>.
-- If <where> is less than zero or greater than the lenght of
-- <me>, an exception is raised.
-- Example:
-- aString contains "Hello"
-- aString.Value(2) returns 'e'
-- Exceptions
-- Standard_OutOfRange if where lies outside
-- the bounds of this extended string.
raises OutOfRange from Standard
is static;
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)
returns Boolean;
---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;
---Purpose: Converts the internal <mystring> to UTF8 coding and
-- returns length of the out CString. A memory for the
-- <theCString> should be allocated before call!
LengthOfCString(me)
returns Integer from Standard;
---Purpose: Returns expected CString length in UTF8 coding.
-- It can be used for memory calculation before converting
-- to CString containing symbols in UTF8 coding.
ConvertToUnicode(me : out; astring : CString)
returns Boolean is private;
---Purpose: Returns true if the input CString was successfuly converted
-- to UTF8 coding
fields
mystring : PExtCharacter from Standard;
mylength : Integer from Standard;
end ExtendedString from TCollection;

View File

@@ -12,16 +12,18 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TCollection_ExtendedString.ixx>
#include <Standard.hxx>
#include <Standard_ExtString.hxx>
#include <Standard_NegativeValue.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_NumericError.hxx>
#include <Standard_OutOfRange.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <cstdio>
#include <cctype>
#include <cstdio>
static
Standard_PExtCharacter Allocate(const Standard_Size aLength);

View File

@@ -0,0 +1,348 @@
// Created on: 1993-02-22
// Created by: Mireille MERCIEN
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TCollection_ExtendedString_HeaderFile
#define _TCollection_ExtendedString_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_PExtCharacter.hxx>
#include <Standard_Integer.hxx>
#include <Standard_CString.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_ExtString.hxx>
#include <Standard_Character.hxx>
#include <Standard_ExtCharacter.hxx>
#include <Standard_Real.hxx>
#include <Standard_OStream.hxx>
#include <Standard_PCharacter.hxx>
class Standard_NullObject;
class Standard_OutOfRange;
class Standard_NumericError;
class Standard_NegativeValue;
class TCollection_AsciiString;
//! A variable-length sequence of "extended"
//! (UNICODE) characters (16-bit character type). It
//! provides editing operations with built-in memory
//! management to make ExtendedString objects
//! easier to use than ordinary extended character arrays.
//! ExtendedString objects follow "value
//! semantics", that is, they are the actual strings,
//! not handles to strings, and are copied through
//! assignment. You may use HExtendedString
//! objects to get handles to strings.
class TCollection_ExtendedString
{
public:
DEFINE_STANDARD_ALLOC
//! Initializes a ExtendedString to an empty ExtendedString.
Standard_EXPORT TCollection_ExtendedString();
//! Creation by converting a CString to an extended
//! string. If <isMultiByte> is true then the string is
//! treated as having UTF-8 coding. If it is not a UTF-8
//! then <isMultiByte> is ignored and each character is
//! copied to ExtCharacter.
Standard_EXPORT TCollection_ExtendedString(const Standard_CString astring, const Standard_Boolean isMultiByte = Standard_False);
//! Creation by converting an ExtString to an extended string.
Standard_EXPORT TCollection_ExtendedString(const Standard_ExtString astring);
//! Initializes a AsciiString with a single character.
Standard_EXPORT TCollection_ExtendedString(const Standard_Character aChar);
//! Initializes a ExtendedString with a single character.
Standard_EXPORT TCollection_ExtendedString(const Standard_ExtCharacter aChar);
//! Initializes a ExtendedString with <length> space allocated.
//! and filled with <filler>.This is useful for buffers.
Standard_EXPORT TCollection_ExtendedString(const Standard_Integer length, const Standard_ExtCharacter filler);
//! Initializes an ExtendedString with an integer value
Standard_EXPORT TCollection_ExtendedString(const Standard_Integer value);
//! Initializes an ExtendedString with a real value
Standard_EXPORT TCollection_ExtendedString(const Standard_Real value);
//! Initializes a ExtendedString with another ExtendedString.
Standard_EXPORT TCollection_ExtendedString(const TCollection_ExtendedString& astring);
//! Creation by converting an Ascii string to an extended
//! string. The string is treated as having UTF-8 coding.
//! If it is not a UTF-8 then each character is copied to ExtCharacter.
Standard_EXPORT TCollection_ExtendedString(const TCollection_AsciiString& astring);
//! Appends the other extended string to this extended string.
//! Note that this method is an alias of operator +=.
//! Example: aString += anotherString
Standard_EXPORT void AssignCat (const TCollection_ExtendedString& other);
void operator += (const TCollection_ExtendedString& other)
{
AssignCat(other);
}
//! Appends <other> to me.
Standard_EXPORT TCollection_ExtendedString Cat (const TCollection_ExtendedString& other) const;
TCollection_ExtendedString operator + (const TCollection_ExtendedString& other) const
{
return Cat(other);
}
//! Substitutes all the characters equal to aChar by NewChar
//! in the ExtendedString <me>.
//! The substitution can be case sensitive.
//! If you don't use default case sensitive, no matter wether aChar
//! is uppercase or not.
Standard_EXPORT void ChangeAll (const Standard_ExtCharacter aChar, const Standard_ExtCharacter NewChar);
//! Removes all characters contained in <me>.
//! This produces an empty ExtendedString.
Standard_EXPORT void Clear();
//! Copy <fromwhere> to <me>.
//! Used as operator =
Standard_EXPORT void Copy (const TCollection_ExtendedString& fromwhere);
void operator = (const TCollection_ExtendedString& fromwhere)
{
Copy(fromwhere);
}
//! Frees memory allocated by ExtendedString.
Standard_EXPORT void Destroy();
~TCollection_ExtendedString()
{
Destroy();
}
//! Insert a Character at position <where>.
Standard_EXPORT void Insert (const Standard_Integer where, const Standard_ExtCharacter what);
//! Insert a ExtendedString at position <where>.
Standard_EXPORT void Insert (const Standard_Integer where, const TCollection_ExtendedString& what);
//! Returns True if this string contains no characters.
Standard_Boolean IsEmpty() const;
//! 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 ==
Standard_EXPORT Standard_Boolean IsEqual (const Standard_ExtString other) const;
Standard_Boolean operator == (const Standard_ExtString other) const
{
return IsEqual(other);
}
//! 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 ==
Standard_EXPORT Standard_Boolean IsEqual (const TCollection_ExtendedString& other) const;
Standard_Boolean operator == (const TCollection_ExtendedString& other) const
{
return IsEqual(other);
}
//! Returns true if there are differences between the
//! characters in this extended string and the other extended string.
//! Note that this method is an alias of operator !=.
Standard_EXPORT Standard_Boolean IsDifferent (const Standard_ExtString other) const;
Standard_Boolean operator != (const Standard_ExtString other) const
{
return IsDifferent(other);
}
//! Returns true if there are differences between the
//! characters in this extended string and the other extended string.
//! Note that this method is an alias of operator !=.
Standard_EXPORT Standard_Boolean IsDifferent (const TCollection_ExtendedString& other) const;
Standard_Boolean operator != (const TCollection_ExtendedString& other) const
{
return IsDifferent(other);
}
//! Returns TRUE if <me> is less than <other>.
Standard_EXPORT Standard_Boolean IsLess (const Standard_ExtString other) const;
Standard_Boolean operator < (const Standard_ExtString other) const
{
return IsLess(other);
}
//! Returns TRUE if <me> is less than <other>.
Standard_EXPORT Standard_Boolean IsLess (const TCollection_ExtendedString& other) const;
Standard_Boolean operator < (const TCollection_ExtendedString& other) const
{
return IsLess(other);
}
//! Returns TRUE if <me> is greater than <other>.
Standard_EXPORT Standard_Boolean IsGreater (const Standard_ExtString other) const;
Standard_Boolean operator > (const Standard_ExtString other) const
{
return IsGreater(other);
}
//! Returns TRUE if <me> is greater than <other>.
Standard_EXPORT Standard_Boolean IsGreater (const TCollection_ExtendedString& other) const;
Standard_Boolean operator > (const TCollection_ExtendedString& other) const
{
return IsGreater(other);
}
//! Returns True if the ExtendedString contains only
//! "Ascii Range" characters .
Standard_EXPORT Standard_Boolean IsAscii() const;
//! Returns number of characters in <me>.
//! This is the same functionality as 'strlen' in C.
Standard_EXPORT Standard_Integer Length() const;
//! Displays <me> .
Standard_EXPORT void Print (Standard_OStream& astream) const;
friend Standard_EXPORT Standard_OStream& operator << (Standard_OStream& astream,const TCollection_ExtendedString& astring);
//! Removes every <what> characters from <me>.
Standard_EXPORT void RemoveAll (const Standard_ExtCharacter what);
//! Erases <ahowmany> characters from position <where>,<where> included.
Standard_EXPORT void Remove (const Standard_Integer where, const Standard_Integer ahowmany = 1);
//! Searches a ExtendedString in <me> from the beginning
//! and returns position of first item <what> matching.
//! it returns -1 if not found.
Standard_EXPORT Standard_Integer Search (const TCollection_ExtendedString& what) const;
//! Searches a ExtendedString in another ExtendedString from the
//! end and returns position of first item <what> matching.
//! it returns -1 if not found.
Standard_EXPORT Standard_Integer SearchFromEnd (const TCollection_ExtendedString& what) const;
//! Replaces one character in the ExtendedString at position <where>.
//! If <where> is less than zero or greater than the length of <me>
//! an exception is raised.
Standard_EXPORT void SetValue (const Standard_Integer where, const Standard_ExtCharacter what);
//! Replaces a part of <me> by another ExtendedString see above.
Standard_EXPORT void SetValue (const Standard_Integer where, const TCollection_ExtendedString& what);
//! Splits this extended string into two sub-strings at position where.
//! - The second sub-string (from position
//! where + 1 of this string to the end) is
//! returned in a new extended string.
//! - this extended string is modified: its last
//! characters are removed, it becomes equal to
//! the first sub-string (from the first character to position where).
//! Example:
//! aString contains "abcdefg"
//! aString.Split(3) gives <me> = "abc" and returns "defg"
Standard_EXPORT TCollection_ExtendedString Split (const Standard_Integer where);
//! Extracts <whichone> token from <me>.
//! By default, the <separators> is set to space and tabulation.
//! By default, the token extracted is the first one (whichone = 1).
//! <separators> contains all separators you need.
//! If no token indexed by <whichone> is found, it returns an empty AsciiString.
//! Example:
//! aString contains "This is a message"
//! aString.Token() returns "This"
//! aString.Token(" ",4) returns "message"
//! aString.Token(" ",2) returns "is"
//! aString.Token(" ",9) returns ""
//! Other separators than space character and tabulation are allowed :
//! aString contains "1234; test:message , value"
//! aString.Token("; :,",4) returns "value"
//! aString.Token("; :,",2) returns "test"
Standard_EXPORT TCollection_ExtendedString Token (const Standard_ExtString separators, const Standard_Integer whichone = 1) const;
//! Returns pointer to ExtString
Standard_EXPORT const Standard_ExtString ToExtString() const;
//! Truncates <me> to <ahowmany> characters.
//! Example: me = "Hello Dolly" -> Trunc(3) -> me = "Hel"
//! Exceptions
//! Standard_OutOfRange if ahowmany is greater
//! than the length of this string.
Standard_EXPORT void Trunc (const Standard_Integer ahowmany);
//! Returns character at position <where> in <me>.
//! If <where> is less than zero or greater than the lenght of
//! <me>, an exception is raised.
//! Example:
//! aString contains "Hello"
//! aString.Value(2) returns 'e'
//! Exceptions
//! Standard_OutOfRange if where lies outside
//! the bounds of this extended string.
Standard_EXPORT Standard_ExtCharacter Value (const Standard_Integer where) const;
//! 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
static Standard_Integer HashCode (const TCollection_ExtendedString& astring, const Standard_Integer Upper);
//! 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 ==.
static Standard_Boolean IsEqual (const TCollection_ExtendedString& string1, const TCollection_ExtendedString& string2);
//! Converts the internal <mystring> to UTF8 coding and
//! returns length of the out CString. A memory for the
//! <theCString> should be allocated before call!
Standard_EXPORT Standard_Integer ToUTF8CString (Standard_PCharacter& theCString) const;
//! Returns expected CString length in UTF8 coding.
//! It can be used for memory calculation before converting
//! to CString containing symbols in UTF8 coding.
Standard_EXPORT Standard_Integer LengthOfCString() const;
protected:
private:
//! Returns true if the input CString was successfuly converted
//! to UTF8 coding
Standard_EXPORT Standard_Boolean ConvertToUnicode (const Standard_CString astring);
Standard_PExtCharacter mystring;
Standard_Integer mylength;
};
#include <TCollection_ExtendedString.lxx>
#endif // _TCollection_ExtendedString_HeaderFile

View File

@@ -1,136 +0,0 @@
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class HArray1 from TCollection
(ItemHArray1 as any;
TheArray1 as Array1 from TCollection(ItemHArray1))
inherits TShared
raises RangeError from Standard,
DimensionMismatch from Standard,
OutOfRange from Standard,
OutOfMemory from Standard
---Purpose: The class HArray1 represents unidimensionnal arrays
-- of fixed size dynamically dimensioned at construction time.
-- As with a C array, the access time to an HArray1 indexed
-- item is constant and is independent of the array size.
-- Arrays are commonly used as elementary data structures
-- for more complex objects.
-- HArray1 objects are handles to arrays.
-- - HArray1 arrays may be shared by several objects.
-- - You may use a TCollection_Array1 structure to have the actual array.
-- HArray1 is a generic class which depends on two parameters:
-- - Item, the type of element in the array,
-- - Array, the actual type of array handled by HArray1.
-- This is an instantiation with Item of the
-- TCollection_Array1 generic class.
-- Warning
-- HArray1 indexes start and end at a user-defined position.
-- Thus, when accessing an item, you must base the index on
-- the lower and upper bounds of the array.
is
Create (Low, Up: Integer from Standard)
returns HArray1 from TCollection
---Purpose: Creates an array of lower bound <Low> and upper
-- bound <Up>. Range error is raised when <Up> is less than <Low>.
raises
RangeError from Standard,
OutOfMemory from Standard;
---C++: inline
Create (Low, Up: Integer from Standard; V : ItemHArray1)
returns HArray1 from TCollection
---Purpose: Creates an array of lower bound <Low> and upper
-- bound <Up>. Range error is raised when <Up> is less than <Low>.
raises
RangeError from Standard,
OutOfMemory from Standard;
---C++: inline
Init(me : mutable; V : ItemHArray1);
---Purpose: Initialize the array with the value <V>
---C++: inline
Length (me) returns Integer from Standard
---Level: Public
---Purpose: Returns the number of elements of <me>.
---C++: inline
is static ;
Lower (me) returns Integer from Standard
---Level: Public
---Purpose: Returns the lower bound.
---C++: inline
is static ;
Upper (me) returns Integer from Standard
---Level: Public
---Purpose: Returns the upper bound.
---C++: inline
is static ;
SetValue (me : mutable; Index: Integer from Standard; Value: ItemHArray1)
---Level: Public
---Purpose: Assigns the value <Value> to the <Index>th item of this array.
raises
OutOfRange from Standard
---C++: inline
is static ;
Value (me; Index:Integer from Standard) returns any ItemHArray1
---Level: Public
---Purpose: Returns the value of the <Index>th element of the array.
---C++: inline
---C++: return const &
raises
OutOfRange from Standard
is static ;
ChangeValue (me : mutable; Index:Integer from Standard) returns any
ItemHArray1
---Level: Public
---Purpose: Returns the value of the <Index>th element of the array.
---C++: inline
---C++: return &
raises
OutOfRange from Standard
is static ;
Array1(me) returns TheArray1
---Purpose: Returns the Array array used as a field by this array;
-- the returned array is not modifiable;
---C++: return const &
---C++: inline
is static;
ChangeArray1(me : mutable) returns TheArray1
---Purpose: Returns a modifiable reference on the Array array
-- used as a field by this array, in order to modify it.
---C++: return &
---C++: inline
is static;
fields
myArray : TheArray1;
end HArray1 ;

View File

@@ -1,145 +0,0 @@
-- Created on: 1992-12-17
-- Created by: Mireille MERCIEN
-- Copyright (c) 1992-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class HArray2 from TCollection
(ItemHArray2 as any;
TheArray2 as Array2 from TCollection(ItemHArray2))
inherits TShared
---Purpose: The class HArray2 represents bi-dimensionnal arrays
-- of fixed size dynamically dimensioned at construction time.
-- As with a C array, the access time to an HArray2 indexed
-- item is constant and is independent of the array size.
-- Arrays are commonly used as elementary data structures for more complex objects.
-- HArray2 objects are handles to arrays.
-- - HArray2 arrays may be shared by several objects.
-- - You may use a TCollection_Array2 structure to get the actual array.
-- HArray2 is a generic class which depends on two parameters:
-- - Item, the type of element in the array,
-- - Array, the actual type of array handled by HArray2.
-- This is an instantiation with Item of the TCollection_Array2 generic class.
-- Warning
-- HArray2 indexes start and end at a user-defined position.
-- Thus, when accessing an item you must base the indexes
-- on the lower and upper bounds of the array.
raises
RangeError from Standard,
OutOfRange from Standard,
OutOfMemory from Standard,
DimensionMismatch from Standard
is
Create (R1, R2, C1, C2: Integer from Standard)
returns HArray2 from TCollection
---Purpose: Creates an array of lower bound <R1><C1> and upper
-- bound <R2><C2>. Range from Standard error is
-- raised when <R2> is less than <R1> or <C2> is less than <C1>.
raises
RangeError from Standard,
OutOfMemory from Standard;
---C++: inline
Create (R1, R2, C1, C2: Integer from Standard; V : ItemHArray2)
returns HArray2 from TCollection
---Purpose: Creates an array of lower bound <R1><C1> and upper
-- bound <R2><C2>. Range from Standard error is
-- raised when <R2> is less than <R1> or <C2> is less than <C1>.
raises
RangeError from Standard,
OutOfMemory from Standard;
---C++: inline
Init(me : mutable; V : ItemHArray2) ;
---Purpose: Initializes the array with the value <V>
---C++: inline
ColLength (me) returns Integer from Standard
---Purpose: Returns the number of rows of <me>.
---C++: inline
is static ;
RowLength (me) returns Integer from Standard
---Purpose: Returns the number of columns of <me>.
---C++: inline
is static;
LowerCol (me) returns Integer from Standard
---Purpose: Returns the lower column number of the array.
---C++: inline
is static ;
LowerRow (me) returns Integer from Standard
---Purpose: Returns the lower row number of the array.
---C++: inline
is static ;
UpperCol (me) returns Integer from Standard
---Purpose: Returns the upper column number of the array.
---C++: inline
is static ;
UpperRow (me) returns Integer from Standard
---Purpose: Returns the upper row number of the array.
---C++: inline
is static ;
SetValue (me : mutable; Row, Col: Integer from Standard;
---C++: inline
Value: ItemHArray2)
---Purpose: Assigns the value Value to the (Row,Col) item of this array.
---C++: inline
raises OutOfRange from Standard
is static ;
Value (me; Row,Col: Integer from Standard) returns any ItemHArray2
---Level: Public
---Purpose: Returns the value of the element of index <Row><Col>
---C++: return const &
---C++: inline
raises OutOfRange from Standard
is static;
ChangeValue (me : mutable; Row,Col: Integer from Standard)
returns any ItemHArray2
---Level: Public
---Purpose: Returns the value of the element of index <Row><Col>
---C++: return &
---C++: inline
raises OutOfRange from Standard
is static;
Array2(me) returns TheArray2
---Purpose: Returns the Array array used as a field by this array;
-- the returned array is not modifiable.
---C++: return const &
---C++: inline
is static;
ChangeArray2(me : mutable) returns TheArray2
---Purpose: - Returns a modifiable reference on the Array array
-- used as a field by this array, in order to modify it.
---C++: return &
---C++: inline
is static;
fields
myArray : TheArray2;
end HArray2 ;

View File

@@ -1,584 +0,0 @@
-- Created on: 1992-12-15
-- Created by: Mireille MERCIEN
-- Copyright (c) 1992-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class HAsciiString from TCollection
inherits TShared from MMgt
---Purpose: A variable-length sequence of ASCII characters
-- (normal 8-bit character type). It provides editing
-- operations with built-in memory management to
-- make HAsciiString objects easier to use than ordinary character arrays.
-- HAsciiString objects are handles to strings.
-- - HAsciiString strings may be shared by several objects.
-- - You may use an AsciiString object to get the actual string.
-- Note: HAsciiString objects use an AsciiString string as a field.
uses AsciiString from TCollection
,HExtendedString from TCollection
raises
NullObject,
OutOfRange,
NumericError,
NegativeValue
is
Create returns HAsciiString from TCollection;
---Purpose: Initializes a HAsciiString to an empty AsciiString.
Create ( message : CString )
returns HAsciiString from TCollection
---Purpose: Initializes a HAsciiString with a CString.
raises NullObject;
Create ( aChar : Character)
returns HAsciiString from TCollection;
---Purpose: Initializes a HAsciiString with a single character.
Create ( length : Integer; filler : Character)
returns HAsciiString from TCollection;
---Purpose: Initializes a HAsciiString with <length> space allocated.
-- and filled with <filler>.This is useful for buffers.
Create ( value : Integer )
returns HAsciiString from TCollection
---Purpose: Initializes a HAsciiString with an integer value
raises NullObject;
Create ( value : Real )
returns HAsciiString from TCollection
---Purpose: Initializes a HAsciiString with a real value
raises NullObject;
Create ( aString : AsciiString from TCollection)
returns HAsciiString from TCollection;
---Purpose: Initializes a HAsciiString with a HAsciiString.
Create ( aString : HAsciiString from TCollection)
returns HAsciiString from TCollection;
---Purpose: Initializes a HAsciiString with a HAsciiString.
Create ( aString : HExtendedString from TCollection;
replaceNonAscii: Character from Standard)
returns HAsciiString from TCollection
raises OutOfRange from Standard;
---Purpose: Initializes a HAsciiString with a HAsciiString.
-- If replaceNonAscii is non-null charecter, it will be used
-- in place of any non-ascii character found in the source string.
-- Otherwise, raises OutOfRange exception if at least one character
-- in the source string is not in the "Ascii range".
AssignCat (me : mutable ; other : CString)
---C++: inline
---Level: Public
---Purpose: Appends <other> to me.
raises NullObject;
AssignCat (me : mutable ; other : HAsciiString from TCollection);
---C++: inline
---Level: Public
---Purpose: Appends <other> to me.
-- Example: aString = aString + anotherString
Capitalize(me : mutable);
---Level: Public
---Purpose: Converts the first character into its corresponding
-- upper-case character and the other characters into lowercase.
-- Example:
-- before
-- me = "hellO "
-- after
-- me = "Hello "
Cat (me ; other : CString)
returns HAsciiString from TCollection;
---Level: Public
---Purpose: Creates a new string by concatenation of this
-- ASCII string and the other ASCII string.
-- Example:
-- aString = aString + anotherString
-- aString = aString + "Dummy"
-- aString contains "I say "
-- aString = aString + "Hello " + "Dolly"
-- gives "I say Hello Dolly"
-- Warning: To catenate more than one CString, you must put a String before.
-- So the following example is WRONG !
-- aString = "Hello " + "Dolly" THIS IS NOT ALLOWED
-- This rule is applicable to AssignCat (operator +=) too.
Cat (me ; other : HAsciiString from TCollection)
returns HAsciiString from TCollection;
---Level: Public
---Purpose: Creates a new string by concatenation of this
-- ASCII string and the other ASCII string.
-- Example: aString = aString + anotherString
Center(me : mutable;
Width : Integer from Standard;
Filler : Character from Standard)
raises NegativeValue from Standard;
---Purpose: Modifies this ASCII string so that its length
-- becomes equal to Width and the new characters
-- are equal to Filler. New characters are added
-- both at the beginning and at the end of this string.
-- If Width is less than the length of this ASCII string, nothing happens.
-- Example
-- Handle(TCollection_HAsciiString)
-- myAlphabet
-- = new
-- TCollection_HAsciiString
-- ("abcdef");
-- myAlphabet->Center(9,' ');
-- assert ( !strcmp(
-- myAlphabet->ToCString(),
-- " abcdef ") );
ChangeAll(me : mutable; aChar, NewChar : Character;
CaseSensitive : Boolean=Standard_True);
---Purpose: Replaces all characters equal to aChar by
-- NewChar in this ASCII string. The substitution is
-- case sensitive if CaseSensitive is true (default value).
-- If you do not use the default case sensitive
-- option, it does not matter whether aChar is upper-case or not.
-- Example
-- Handle(TCollection_HAsciiString)
-- myMistake = new
-- TCollection_HAsciiString
-- ("Hather");
-- myMistake->ChangeAll('H','F');
-- assert ( !strcmp(
-- myMistake->ToCString(),
-- "Father") );
Clear (me : mutable);
---Level: Public
---Purpose: Removes all characters contained in <me>.
-- This produces an empty HAsciiString.
FirstLocationInSet(me; Set : HAsciiString from TCollection;
FromIndex : Integer from Standard;
ToIndex : Integer from Standard)
returns Integer
raises OutOfRange from Standard;
---Level: Public
---Purpose: Returns the index of the first character of <me> that is
-- present in <Set>.
-- The search begins to the index FromIndex and ends to the
-- the index ToIndex.
-- Returns zero if failure.
-- Raises an exception if FromIndex or ToIndex is out of range
-- Example:
-- before
-- me = "aabAcAa", S = "Aa", FromIndex = 1, Toindex = 7
-- after
-- me = "aabAcAa"
-- returns
-- 1
FirstLocationNotInSet(me; Set : HAsciiString from TCollection;
FromIndex : Integer;
ToIndex : Integer) returns Integer
raises OutOfRange from Standard;
---Level: Public
---Purpose: Returns the index of the first character of <me>
-- that is not present in the set <Set>.
-- The search begins to the index FromIndex and ends to the
-- the index ToIndex in <me>.
-- Returns zero if failure.
-- Raises an exception if FromIndex or ToIndex is out of range.
-- Example:
-- before
-- me = "aabAcAa", S = "Aa", FromIndex = 1, Toindex = 7
-- after
-- me = "aabAcAa"
-- returns
-- 3
Insert (me : mutable; where : Integer; what : Character)
---Level: Public
---Purpose: Insert a Character at position <where>.
-- Example:
-- aString contains "hy not ?"
-- aString.Insert(1,'W'); gives "Why not ?"
-- aString contains "Wh"
-- aString.Insert(3,'y'); gives "Why"
-- aString contains "Way"
-- aString.Insert(2,'h'); gives "Why"
raises OutOfRange;
Insert (me : mutable; where : Integer; what : CString )
---Level: Public
---Purpose: Insert a HAsciiString at position <where>.
raises OutOfRange;
Insert (me : mutable; where : Integer; what : HAsciiString from TCollection)
---Level: Public
---Purpose: Insert a HAsciiString at position <where>.
raises OutOfRange;
InsertAfter(me : mutable; Index : Integer;
other : HAsciiString from TCollection)
raises OutOfRange from Standard;
---Purpose: Inserts the other ASCII string a after a specific index in the string <me>
-- Example:
-- before
-- me = "cde" , Index = 0 , other = "ab"
-- after
-- me = "abcde" , other = "ab"
InsertBefore(me : mutable; Index : Integer;
other : HAsciiString from TCollection)
raises OutOfRange from Standard;
---Purpose: Inserts the other ASCII string a before a specific index in the string <me>
-- Raises an exception if Index is out of bounds
-- Example:
-- before
-- me = "cde" , Index = 1 , other = "ab"
-- after
-- me = "abcde" , other = "ab"
IsEmpty(me) returns Boolean from Standard;
---Purpose: Returns True if the string <me> contains zero character
IsLess (me ; other : HAsciiString from TCollection) returns Boolean;
---Level: Public
---Purpose: Returns TRUE if <me> is 'ASCII' less than <other>.
IsGreater (me ; other : HAsciiString from TCollection) returns Boolean;
---Level: Public
---Purpose: Returns TRUE if <me> is 'ASCII' greater than <other>.
IntegerValue(me) returns Integer
---Level: Public
---Purpose: Converts a HAsciiString containing a numeric expression to
-- an Integer.
-- Example: "215" returns 215.
raises NumericError;
IsIntegerValue(me) returns Boolean from Standard;
---Purpose: Returns True if the string contains an integer value.
IsRealValue(me) returns Boolean from Standard;
---Purpose: Returns True if the string contains a real value.
IsAscii(me) returns Boolean from Standard;
---Level: Public
---Purpose: Returns True if the string contains only ASCII characters
-- between ' ' and '~'.
-- This means no control character and no extended ASCII code.
IsDifferent(me ; S : HAsciiString from TCollection)
---Level: Public
---Purpose: Returns True if the string S not contains same characters than
-- the string <me>.
returns Boolean from Standard;
IsSameString(me ; S : HAsciiString from TCollection)
---Level: Public
---Purpose: Returns True if the string S contains same characters than the
-- string <me>.
returns Boolean from Standard;
IsSameString(me ; S : HAsciiString from TCollection ;
CaseSensitive : Boolean from Standard)
---Level: Public
---Purpose: Returns True if the string S contains same characters than the
-- string <me>.
returns Boolean from Standard;
LeftAdjust(me : mutable);
---Level: Public
---Purpose: Removes all space characters in the begining of the string
LeftJustify(me : mutable; Width : Integer;
Filler : Character from Standard)
raises NegativeValue from Standard;
---Level: Public
---Purpose: Left justify.
-- Length becomes equal to Width and the new characters are
-- equal to Filler
-- if Width < Length nothing happens
-- Raises an exception if Width is less than zero
-- Example:
-- before
-- me = "abcdef" , Width = 9 , Filler = ' '
-- after
-- me = "abcdef "
Length (me) returns Integer;
---C++: inline
---Level: Public
---Purpose: Returns number of characters in <me>.
-- This is the same functionality as 'strlen' in C.
Location(me; other : HAsciiString from TCollection;
FromIndex : Integer;
ToIndex : Integer)
returns Integer
raises OutOfRange from Standard;
---Level: Public
---Purpose: returns an index in the string <me> of the first occurence
-- of the string S in the string <me> from the starting index
-- FromIndex to the ending index ToIndex
-- returns zero if failure
-- Raises an exception if FromIndex or ToIndex is out of range.
-- Example:
-- before
-- me = "aabAaAa", S = "Aa", FromIndex = 1, ToIndex = 7
-- after
-- me = "aabAaAa"
-- returns
-- 4
Location(me; N : Integer; C : Character from Standard;
FromIndex : Integer;
ToIndex : Integer)
returns Integer
raises OutOfRange from Standard;
---Level: Public
---Purpose: Returns the index of the nth occurence of the character C
-- in the string <me> from the starting index FromIndex to the
-- ending index ToIndex.
-- Returns zero if failure.
-- Raises an exception if FromIndex or ToIndex is out of range
-- Example:
-- before
-- me = "aabAa", N = 3, C = 'a', FromIndex = 1, ToIndex = 5
-- after
-- me = "aabAa"
-- returns 5
LowerCase (me : mutable);
---Level: Public
---Purpose: Converts <me> to its lower-case equivalent.
Prepend(me : mutable; other : HAsciiString from TCollection);
---Level: Public
---Purpose: Inserts the other string at the begining of the string <me>
-- Example:
-- before
-- me = "cde" , S = "ab"
-- after
-- me = "abcde" , S = "ab"
Print (me ; astream : out OStream);
---Purpose: Prints this string on the stream <astream>.
RealValue(me) returns Real
---Level: Public
---Purpose: Converts a string containing a numeric expression to a Real.
-- Example:
-- "215" returns 215.0.
-- "3.14159267" returns 3.14159267.
raises NumericError;
RemoveAll(me :mutable; C : Character from Standard;
CaseSensitive : Boolean from Standard);
---Level: Public
---Purpose: Remove all the occurences of the character C in the string
-- Example:
-- before
-- me = "HellLLo", C = 'L' , CaseSensitive = True
-- after
-- me = "Hello"
RemoveAll(me : mutable; what : Character);
---Level: Public
---Purpose: Removes every <what> characters from <me>
Remove (me : mutable ; where : Integer ; ahowmany : Integer=1)
---Level: Public
---Purpose: Erases <ahowmany> characters from position <where>,
-- <where> included.
-- Example:
-- aString contains "Hello"
-- aString.Erase(2,2) erases 2 characters from position 1
-- This gives "Hlo".
raises OutOfRange from Standard;
RightAdjust(me : mutable);
---Level: Public
---Purpose: Removes all space characters at the end of the string.
RightJustify(me : mutable;
Width : Integer;
Filler : Character from Standard)
raises NegativeValue from Standard;
---Level: Public
---Purpose: Right justify.
-- Length becomes equal to Width and the new characters are
-- equal to Filler
-- if Width < Length nothing happens
-- Raises an exception if Width is less than zero
-- Example:
-- before
-- me = "abcdef" , Width = 9 , Filler = ' '
-- after
-- me = " abcdef"
Search (me ; what : CString) returns Integer
---Level: Public
---Purpose: Searches a CString in <me> from the beginning
-- and returns position of first item <what> matching.
-- It returns -1 if not found.
-- Example:
-- aString contains "Sample single test"
-- aString.Search("le") returns 5
--
raises NullObject from Standard;
Search (me ; what : HAsciiString from TCollection) returns Integer;
---Level: Public
---Purpose: Searches a String in <me> from the beginning
-- and returns position of first item <what> matching.
-- it returns -1 if not found.
SearchFromEnd (me ; what : CString) returns Integer
---Level: Public
---Purpose: Searches a CString in a String from the end
-- and returns position of first item <what> matching.
-- It returns -1 if not found.
-- Example:
-- aString contains "Sample single test"
-- aString.SearchFromEnd("le") returns 12
raises NullObject from Standard;
SearchFromEnd (me ; what : HAsciiString from TCollection) returns Integer;
---Level: Public
---Purpose: Searches a HAsciiString in another HAsciiString from the end
-- and returns position of first item <what> matching.
-- It returns -1 if not found.
SetValue(me : mutable; where : Integer; what : Character)
---Level: Public
---Purpose: Replaces one character in the string at position <where>.
-- If <where> is less than zero or greater than the length of <me>
-- an exception is raised.
-- Example:
-- aString contains "Garbake"
-- astring.Replace(6,'g') gives <me> = "Garbage"
raises OutOfRange from Standard;
SetValue(me : mutable; where : Integer; what : CString)
---Level: Public
---Purpose: Replaces a part of <me> in the string at position <where>.
-- If <where> is less than zero or greater than the length of <me>
-- an exception is raised.
-- Example:
-- aString contains "Garbake"
-- astring.Replace(6,'g') gives <me> = "Garbage"
raises OutOfRange from Standard;
SetValue(me : mutable; where : Integer; what : HAsciiString from TCollection)
---Level: Public
---Purpose: Replaces a part of <me> by another string.
raises OutOfRange from Standard;
Split(me : mutable; where : Integer)
returns HAsciiString from TCollection
---Level: Public
---Purpose: Splits a HAsciiString into two sub-strings.
-- Example:
-- aString contains "abcdefg"
-- aString.Split(3) gives <me> = "abc" and returns "defg"
raises OutOfRange from Standard;
SubString(me; FromIndex, ToIndex : Integer)
---Level: Public
---Purpose: Creation of a sub-string of the string <me>.
-- The sub-string starts to the index Fromindex and ends
-- to the index ToIndex.
-- Raises an exception if ToIndex or FromIndex is out of
-- bounds
-- Example:
-- before
-- me = "abcdefg", ToIndex=3, FromIndex=6
-- after
-- me = "abcdefg"
-- returns
-- "cdef"
returns HAsciiString from TCollection
raises OutOfRange from Standard;
ToCString(me) returns CString;
---Level: Public
---Purpose: Returns pointer to string (char *)
-- This is useful for some casual manipulations
-- Because this "char *" is 'const', you can't modify its contents.
---C++: inline
Token (me ; separators : CString=" \t" ; whichone : Integer=1)
returns HAsciiString from TCollection
---Level: Public
---Purpose: Extracts <whichone> token from <me>.
-- By default, the <separators> is set to space and tabulation.
-- By default, the token extracted is the first one (whichone = 1).
-- <separators> contains all separators you need.
-- If no token indexed by <whichone> is found, it returns an empty String.
-- Example:
-- aString contains "This is a message"
-- aString.Token() returns "This"
-- aString.Token(" ",4) returns "message"
-- aString.Token(" ",2) returns "is"
-- aString.Token(" ",9) returns ""
-- Other separators than space character and tabulation are allowed
-- aString contains "1234; test:message , value"
-- aString.Token("; :,",4) returns "value"
-- aString.Token("; :,",2) returns "test"
raises NullObject from Standard;
Trunc (me : mutable ; ahowmany : Integer)
---Level: Public
---Purpose: Truncates <me> to <ahowmany> characters.
-- Example: me = "Hello Dolly" -> Trunc(3) -> me = "Hel"
raises OutOfRange from Standard;
UpperCase (me : mutable);
---Level: Public
---Purpose: Converts <me> to its upper-case equivalent.
UsefullLength(me) returns Integer;
---Level: Public
---Purpose: Length of the string ignoring all spaces (' ') and the
-- control character at the end.
Value(me ; where : Integer) returns Character
---Level: Public
---Purpose: Returns character at position <where> in <me>.
-- If <where> is less than zero or greater than the lenght of
-- <me>, an exception is raised.
-- Example:
-- aString contains "Hello"
-- aString.Value(2) returns 'e'
raises OutOfRange from Standard;
String(me) returns AsciiString from TCollection;
---C++: return const &
---C++: inline
---Level: Advanced
---Purpose: Returns the field myString.
IsSameState (me ; other : like me)
---Level: Advanced
returns Boolean;
fields
myString : AsciiString from TCollection;
end;

View File

@@ -12,7 +12,14 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TCollection_HAsciiString.ixx>
#include <Standard_NegativeValue.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_NumericError.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TCollection_HExtendedString.hxx>
// ----------------------------------------------------------------------------

View File

@@ -0,0 +1,496 @@
// Created on: 1992-12-15
// Created by: Mireille MERCIEN
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TCollection_HAsciiString_HeaderFile
#define _TCollection_HAsciiString_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_CString.hxx>
#include <Standard_Character.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_OStream.hxx>
class Standard_NullObject;
class Standard_OutOfRange;
class Standard_NumericError;
class Standard_NegativeValue;
class TCollection_AsciiString;
class TCollection_HExtendedString;
class TCollection_HAsciiString;
DEFINE_STANDARD_HANDLE(TCollection_HAsciiString, MMgt_TShared)
//! A variable-length sequence of ASCII characters
//! (normal 8-bit character type). It provides editing
//! operations with built-in memory management to
//! make HAsciiString objects easier to use than ordinary character arrays.
//! HAsciiString objects are handles to strings.
//! - HAsciiString strings may be shared by several objects.
//! - You may use an AsciiString object to get the actual string.
//! Note: HAsciiString objects use an AsciiString string as a field.
class TCollection_HAsciiString : public MMgt_TShared
{
public:
//! Initializes a HAsciiString to an empty AsciiString.
Standard_EXPORT TCollection_HAsciiString();
//! Initializes a HAsciiString with a CString.
Standard_EXPORT TCollection_HAsciiString(const Standard_CString message);
//! Initializes a HAsciiString with a single character.
Standard_EXPORT TCollection_HAsciiString(const Standard_Character aChar);
//! Initializes a HAsciiString with <length> space allocated.
//! and filled with <filler>.This is useful for buffers.
Standard_EXPORT TCollection_HAsciiString(const Standard_Integer length, const Standard_Character filler);
//! Initializes a HAsciiString with an integer value
Standard_EXPORT TCollection_HAsciiString(const Standard_Integer value);
//! Initializes a HAsciiString with a real value
Standard_EXPORT TCollection_HAsciiString(const Standard_Real value);
//! Initializes a HAsciiString with a HAsciiString.
Standard_EXPORT TCollection_HAsciiString(const TCollection_AsciiString& aString);
//! Initializes a HAsciiString with a HAsciiString.
Standard_EXPORT TCollection_HAsciiString(const Handle(TCollection_HAsciiString)& aString);
//! Initializes a HAsciiString with a HAsciiString.
//! If replaceNonAscii is non-null charecter, it will be used
//! in place of any non-ascii character found in the source string.
//! Otherwise, raises OutOfRange exception if at least one character
//! in the source string is not in the "Ascii range".
Standard_EXPORT TCollection_HAsciiString(const Handle(TCollection_HExtendedString)& aString, const Standard_Character replaceNonAscii);
//! Appends <other> to me.
void AssignCat (const Standard_CString other);
//! Appends <other> to me.
//! Example: aString = aString + anotherString
void AssignCat (const Handle(TCollection_HAsciiString)& other);
//! Converts the first character into its corresponding
//! upper-case character and the other characters into lowercase.
//! Example:
//! before
//! me = "hellO "
//! after
//! me = "Hello "
Standard_EXPORT void Capitalize();
//! Creates a new string by concatenation of this
//! ASCII string and the other ASCII string.
//! Example:
//! aString = aString + anotherString
//! aString = aString + "Dummy"
//! aString contains "I say "
//! aString = aString + "Hello " + "Dolly"
//! gives "I say Hello Dolly"
//! Warning: To catenate more than one CString, you must put a String before.
//! So the following example is WRONG !
//! aString = "Hello " + "Dolly" THIS IS NOT ALLOWED
//! This rule is applicable to AssignCat (operator +=) too.
Standard_EXPORT Handle(TCollection_HAsciiString) Cat (const Standard_CString other) const;
//! Creates a new string by concatenation of this
//! ASCII string and the other ASCII string.
//! Example: aString = aString + anotherString
Standard_EXPORT Handle(TCollection_HAsciiString) Cat (const Handle(TCollection_HAsciiString)& other) const;
//! Modifies this ASCII string so that its length
//! becomes equal to Width and the new characters
//! are equal to Filler. New characters are added
//! both at the beginning and at the end of this string.
//! If Width is less than the length of this ASCII string, nothing happens.
//! Example
//! Handle(TCollection_HAsciiString)
//! myAlphabet
//! = new
//! TCollection_HAsciiString
//! ("abcdef");
//! myAlphabet->Center(9,' ');
//! assert ( !strcmp(
//! myAlphabet->ToCString(),
//! " abcdef ") );
Standard_EXPORT void Center (const Standard_Integer Width, const Standard_Character Filler);
//! Replaces all characters equal to aChar by
//! NewChar in this ASCII string. The substitution is
//! case sensitive if CaseSensitive is true (default value).
//! If you do not use the default case sensitive
//! option, it does not matter whether aChar is upper-case or not.
//! Example
//! Handle(TCollection_HAsciiString)
//! myMistake = new
//! TCollection_HAsciiString
//! ("Hather");
//! myMistake->ChangeAll('H','F');
//! assert ( !strcmp(
//! myMistake->ToCString(),
//! "Father") );
Standard_EXPORT void ChangeAll (const Standard_Character aChar, const Standard_Character NewChar, const Standard_Boolean CaseSensitive = Standard_True);
//! Removes all characters contained in <me>.
//! This produces an empty HAsciiString.
Standard_EXPORT void Clear();
//! Returns the index of the first character of <me> that is
//! present in <Set>.
//! The search begins to the index FromIndex and ends to the
//! the index ToIndex.
//! Returns zero if failure.
//! Raises an exception if FromIndex or ToIndex is out of range
//! Example:
//! before
//! me = "aabAcAa", S = "Aa", FromIndex = 1, Toindex = 7
//! after
//! me = "aabAcAa"
//! returns
//! 1
Standard_EXPORT Standard_Integer FirstLocationInSet (const Handle(TCollection_HAsciiString)& Set, const Standard_Integer FromIndex, const Standard_Integer ToIndex) const;
//! Returns the index of the first character of <me>
//! that is not present in the set <Set>.
//! The search begins to the index FromIndex and ends to the
//! the index ToIndex in <me>.
//! Returns zero if failure.
//! Raises an exception if FromIndex or ToIndex is out of range.
//! Example:
//! before
//! me = "aabAcAa", S = "Aa", FromIndex = 1, Toindex = 7
//! after
//! me = "aabAcAa"
//! returns
//! 3
Standard_EXPORT Standard_Integer FirstLocationNotInSet (const Handle(TCollection_HAsciiString)& Set, const Standard_Integer FromIndex, const Standard_Integer ToIndex) const;
//! Insert a Character at position <where>.
//! Example:
//! aString contains "hy not ?"
//! aString.Insert(1,'W'); gives "Why not ?"
//! aString contains "Wh"
//! aString.Insert(3,'y'); gives "Why"
//! aString contains "Way"
//! aString.Insert(2,'h'); gives "Why"
Standard_EXPORT void Insert (const Standard_Integer where, const Standard_Character what);
//! Insert a HAsciiString at position <where>.
Standard_EXPORT void Insert (const Standard_Integer where, const Standard_CString what);
//! Insert a HAsciiString at position <where>.
Standard_EXPORT void Insert (const Standard_Integer where, const Handle(TCollection_HAsciiString)& what);
//! Inserts the other ASCII string a after a specific index in the string <me>
//! Example:
//! before
//! me = "cde" , Index = 0 , other = "ab"
//! after
//! me = "abcde" , other = "ab"
Standard_EXPORT void InsertAfter (const Standard_Integer Index, const Handle(TCollection_HAsciiString)& other);
//! Inserts the other ASCII string a before a specific index in the string <me>
//! Raises an exception if Index is out of bounds
//! Example:
//! before
//! me = "cde" , Index = 1 , other = "ab"
//! after
//! me = "abcde" , other = "ab"
Standard_EXPORT void InsertBefore (const Standard_Integer Index, const Handle(TCollection_HAsciiString)& other);
//! Returns True if the string <me> contains zero character
Standard_EXPORT Standard_Boolean IsEmpty() const;
//! Returns TRUE if <me> is 'ASCII' less than <other>.
Standard_EXPORT Standard_Boolean IsLess (const Handle(TCollection_HAsciiString)& other) const;
//! Returns TRUE if <me> is 'ASCII' greater than <other>.
Standard_EXPORT Standard_Boolean IsGreater (const Handle(TCollection_HAsciiString)& other) const;
//! Converts a HAsciiString containing a numeric expression to
//! an Integer.
//! Example: "215" returns 215.
Standard_EXPORT Standard_Integer IntegerValue() const;
//! Returns True if the string contains an integer value.
Standard_EXPORT Standard_Boolean IsIntegerValue() const;
//! Returns True if the string contains a real value.
Standard_EXPORT Standard_Boolean IsRealValue() const;
//! Returns True if the string contains only ASCII characters
//! between ' ' and '~'.
//! This means no control character and no extended ASCII code.
Standard_EXPORT Standard_Boolean IsAscii() const;
//! Returns True if the string S not contains same characters than
//! the string <me>.
Standard_EXPORT Standard_Boolean IsDifferent (const Handle(TCollection_HAsciiString)& S) const;
//! Returns True if the string S contains same characters than the
//! string <me>.
Standard_EXPORT Standard_Boolean IsSameString (const Handle(TCollection_HAsciiString)& S) const;
//! Returns True if the string S contains same characters than the
//! string <me>.
Standard_EXPORT Standard_Boolean IsSameString (const Handle(TCollection_HAsciiString)& S, const Standard_Boolean CaseSensitive) const;
//! Removes all space characters in the begining of the string
Standard_EXPORT void LeftAdjust();
//! Left justify.
//! Length becomes equal to Width and the new characters are
//! equal to Filler
//! if Width < Length nothing happens
//! Raises an exception if Width is less than zero
//! Example:
//! before
//! me = "abcdef" , Width = 9 , Filler = ' '
//! after
//! me = "abcdef "
Standard_EXPORT void LeftJustify (const Standard_Integer Width, const Standard_Character Filler);
//! Returns number of characters in <me>.
//! This is the same functionality as 'strlen' in C.
Standard_Integer Length() const;
//! returns an index in the string <me> of the first occurence
//! of the string S in the string <me> from the starting index
//! FromIndex to the ending index ToIndex
//! returns zero if failure
//! Raises an exception if FromIndex or ToIndex is out of range.
//! Example:
//! before
//! me = "aabAaAa", S = "Aa", FromIndex = 1, ToIndex = 7
//! after
//! me = "aabAaAa"
//! returns
//! 4
Standard_EXPORT Standard_Integer Location (const Handle(TCollection_HAsciiString)& other, const Standard_Integer FromIndex, const Standard_Integer ToIndex) const;
//! Returns the index of the nth occurence of the character C
//! in the string <me> from the starting index FromIndex to the
//! ending index ToIndex.
//! Returns zero if failure.
//! Raises an exception if FromIndex or ToIndex is out of range
//! Example:
//! before
//! me = "aabAa", N = 3, C = 'a', FromIndex = 1, ToIndex = 5
//! after
//! me = "aabAa"
//! returns 5
Standard_EXPORT Standard_Integer Location (const Standard_Integer N, const Standard_Character C, const Standard_Integer FromIndex, const Standard_Integer ToIndex) const;
//! Converts <me> to its lower-case equivalent.
Standard_EXPORT void LowerCase();
//! Inserts the other string at the begining of the string <me>
//! Example:
//! before
//! me = "cde" , S = "ab"
//! after
//! me = "abcde" , S = "ab"
Standard_EXPORT void Prepend (const Handle(TCollection_HAsciiString)& other);
//! Prints this string on the stream <astream>.
Standard_EXPORT void Print (Standard_OStream& astream) const;
//! Converts a string containing a numeric expression to a Real.
//! Example:
//! "215" returns 215.0.
//! "3.14159267" returns 3.14159267.
Standard_EXPORT Standard_Real RealValue() const;
//! Remove all the occurences of the character C in the string
//! Example:
//! before
//! me = "HellLLo", C = 'L' , CaseSensitive = True
//! after
//! me = "Hello"
Standard_EXPORT void RemoveAll (const Standard_Character C, const Standard_Boolean CaseSensitive);
//! Removes every <what> characters from <me>
Standard_EXPORT void RemoveAll (const Standard_Character what);
//! Erases <ahowmany> characters from position <where>,
//! <where> included.
//! Example:
//! aString contains "Hello"
//! aString.Erase(2,2) erases 2 characters from position 1
//! This gives "Hlo".
Standard_EXPORT void Remove (const Standard_Integer where, const Standard_Integer ahowmany = 1);
//! Removes all space characters at the end of the string.
Standard_EXPORT void RightAdjust();
//! Right justify.
//! Length becomes equal to Width and the new characters are
//! equal to Filler
//! if Width < Length nothing happens
//! Raises an exception if Width is less than zero
//! Example:
//! before
//! me = "abcdef" , Width = 9 , Filler = ' '
//! after
//! me = " abcdef"
Standard_EXPORT void RightJustify (const Standard_Integer Width, const Standard_Character Filler);
//! Searches a CString in <me> from the beginning
//! and returns position of first item <what> matching.
//! It returns -1 if not found.
//! Example:
//! aString contains "Sample single test"
//! aString.Search("le") returns 5
Standard_EXPORT Standard_Integer Search (const Standard_CString what) const;
//! Searches a String in <me> from the beginning
//! and returns position of first item <what> matching.
//! it returns -1 if not found.
Standard_EXPORT Standard_Integer Search (const Handle(TCollection_HAsciiString)& what) const;
//! Searches a CString in a String from the end
//! and returns position of first item <what> matching.
//! It returns -1 if not found.
//! Example:
//! aString contains "Sample single test"
//! aString.SearchFromEnd("le") returns 12
Standard_EXPORT Standard_Integer SearchFromEnd (const Standard_CString what) const;
//! Searches a HAsciiString in another HAsciiString from the end
//! and returns position of first item <what> matching.
//! It returns -1 if not found.
Standard_EXPORT Standard_Integer SearchFromEnd (const Handle(TCollection_HAsciiString)& what) const;
//! Replaces one character in the string at position <where>.
//! If <where> is less than zero or greater than the length of <me>
//! an exception is raised.
//! Example:
//! aString contains "Garbake"
//! astring.Replace(6,'g') gives <me> = "Garbage"
Standard_EXPORT void SetValue (const Standard_Integer where, const Standard_Character what);
//! Replaces a part of <me> in the string at position <where>.
//! If <where> is less than zero or greater than the length of <me>
//! an exception is raised.
//! Example:
//! aString contains "Garbake"
//! astring.Replace(6,'g') gives <me> = "Garbage"
Standard_EXPORT void SetValue (const Standard_Integer where, const Standard_CString what);
//! Replaces a part of <me> by another string.
Standard_EXPORT void SetValue (const Standard_Integer where, const Handle(TCollection_HAsciiString)& what);
//! Splits a HAsciiString into two sub-strings.
//! Example:
//! aString contains "abcdefg"
//! aString.Split(3) gives <me> = "abc" and returns "defg"
Standard_EXPORT Handle(TCollection_HAsciiString) Split (const Standard_Integer where);
//! Creation of a sub-string of the string <me>.
//! The sub-string starts to the index Fromindex and ends
//! to the index ToIndex.
//! Raises an exception if ToIndex or FromIndex is out of
//! bounds
//! Example:
//! before
//! me = "abcdefg", ToIndex=3, FromIndex=6
//! after
//! me = "abcdefg"
//! returns
//! "cdef"
Standard_EXPORT Handle(TCollection_HAsciiString) SubString (const Standard_Integer FromIndex, const Standard_Integer ToIndex) const;
//! Returns pointer to string (char *)
//! This is useful for some casual manipulations
//! Because this "char *" is 'const', you can't modify its contents.
Standard_CString ToCString() const;
//! Extracts <whichone> token from <me>.
//! By default, the <separators> is set to space and tabulation.
//! By default, the token extracted is the first one (whichone = 1).
//! <separators> contains all separators you need.
//! If no token indexed by <whichone> is found, it returns an empty String.
//! Example:
//! aString contains "This is a message"
//! aString.Token() returns "This"
//! aString.Token(" ",4) returns "message"
//! aString.Token(" ",2) returns "is"
//! aString.Token(" ",9) returns ""
//! Other separators than space character and tabulation are allowed
//! aString contains "1234; test:message , value"
//! aString.Token("; :,",4) returns "value"
//! aString.Token("; :,",2) returns "test"
Standard_EXPORT Handle(TCollection_HAsciiString) Token (const Standard_CString separators = " \t", const Standard_Integer whichone = 1) const;
//! Truncates <me> to <ahowmany> characters.
//! Example: me = "Hello Dolly" -> Trunc(3) -> me = "Hel"
Standard_EXPORT void Trunc (const Standard_Integer ahowmany);
//! Converts <me> to its upper-case equivalent.
Standard_EXPORT void UpperCase();
//! Length of the string ignoring all spaces (' ') and the
//! control character at the end.
Standard_EXPORT Standard_Integer UsefullLength() const;
//! Returns character at position <where> in <me>.
//! If <where> is less than zero or greater than the lenght of
//! <me>, an exception is raised.
//! Example:
//! aString contains "Hello"
//! aString.Value(2) returns 'e'
Standard_EXPORT Standard_Character Value (const Standard_Integer where) const;
//! Returns the field myString.
const TCollection_AsciiString& String() const;
Standard_EXPORT Standard_Boolean IsSameState (const Handle(TCollection_HAsciiString)& other) const;
DEFINE_STANDARD_RTTI(TCollection_HAsciiString,MMgt_TShared)
protected:
private:
TCollection_AsciiString myString;
};
#include <TCollection_HAsciiString.lxx>
#endif // _TCollection_HAsciiString_HeaderFile

View File

@@ -1,233 +0,0 @@
-- Created on: 1993-03-17
-- Created by: Mireille MERCIEN
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class HExtendedString from TCollection
inherits TShared from MMgt
---Purpose: A variable-length sequence of "extended"
-- (UNICODE) characters (16-bit character
-- type). It provides editing operations with
-- built-in memory management to make
-- ExtendedString objects easier to use than
-- ordinary extended character arrays.
-- HExtendedString objects are handles to strings.
-- - HExtendedString strings may be shared by several objects.
-- - You may use an ExtendedString object to get the actual string.
-- Note: HExtendedString objects use an
-- ExtendedString string as a field.
uses ExtendedString from TCollection
,HAsciiString from TCollection
raises
NullObject from Standard,
OutOfRange from Standard,
NumericError from Standard,
NegativeValue from Standard
is
Create returns HExtendedString from TCollection;
---Purpose: Initializes a HExtendedString to an empty ExtendedString.
Create ( message : CString )
returns HExtendedString from TCollection
---Purpose: Initializes a HExtendedString with a CString.
raises NullObject from Standard;
Create ( message : ExtString )
returns HExtendedString from TCollection
---Purpose: Initializes a HExtendedString with an ExtString.
raises NullObject from Standard;
Create ( aChar : ExtCharacter)
returns HExtendedString from TCollection;
---Purpose: Initializes a HExtendedString with a single character.
Create ( length : Integer; filler : ExtCharacter)
returns HExtendedString from TCollection;
---Purpose: Initializes a HExtendedString with <length> space allocated.
-- and filled with <filler>.This is usefull for buffers.
Create ( aString : ExtendedString from TCollection)
returns HExtendedString from TCollection;
---Purpose: Initializes a HExtendedString with a HExtendedString.
Create ( aString : HAsciiString from TCollection)
returns HExtendedString from TCollection;
---Purpose: Initializes a HExtendedString with an HAsciiString.
Create ( aString : HExtendedString from TCollection)
returns HExtendedString from TCollection;
---Purpose: Initializes a HExtendedString with a HExtendedString.
AssignCat (me : mutable ; other : HExtendedString from TCollection);
---Purpose: Appends <other> to me.
Cat (me ; other : HExtendedString from TCollection)
returns HExtendedString from TCollection;
---Level: Public
---Purpose: Returns a string appending <other> to me.
ChangeAll(me : mutable; aChar, NewChar : ExtCharacter);
---Level: Public
---Purpose: Substitutes all the characters equal to aChar by NewChar
-- in the string <me>.
Clear (me : mutable);
---Level: Public
---Purpose: Removes all characters contained in <me>.
-- This produces an empty ExtendedString.
IsEmpty(me) returns Boolean from Standard;
---Purpose: Returns True if the string <me> contains zero character
Insert (me : mutable; where : Integer; what : ExtCharacter)
---Purpose: Insert a ExtCharacter at position <where>.
-- Example:
-- aString contains "hy not ?"
-- aString.Insert(1,'W'); gives "Why not ?"
-- aString contains "Wh"
-- aString.Insert(3,'y'); gives "Why"
-- aString contains "Way"
-- aString.Insert(2,'h'); gives "Why"
raises OutOfRange from Standard;
Insert (me : mutable; where : Integer;
what : HExtendedString from TCollection)
---Purpose: Insert a HExtendedString at position <where>.
raises OutOfRange from Standard;
IsLess (me ; other : HExtendedString from TCollection) returns Boolean;
---Purpose: Returns TRUE if <me> is less than <other>.
IsGreater (me ; other : HExtendedString from TCollection) returns Boolean;
---Purpose: Returns TRUE if <me> is greater than <other>.
IsAscii(me) returns Boolean from Standard;
---Purpose: Returns True if the string contains only "Ascii Range" characters
Length (me) returns Integer;
---Purpose: Returns number of characters in <me>.
-- This is the same functionality as 'strlen' in C.
Remove (me : mutable ; where : Integer ; ahowmany : Integer=1)
---Purpose: Erases <ahowmany> characters from position <where>,
-- <where> included.
-- Example:
-- aString contains "Hello"
-- aString.Erase(2,2) erases 2 characters from position 1
-- This gives "Hlo".
raises OutOfRange from Standard;
RemoveAll(me : mutable; what : ExtCharacter);
---Purpose: Removes every <what> characters from <me>.
SetValue(me : mutable; where : Integer; what : ExtCharacter)
---Purpose: Replaces one character in the string at position <where>.
-- If <where> is less than zero or greater than the length of <me>
-- an exception is raised.
-- Example:
-- aString contains "Garbake"
-- astring.Replace(6,'g') gives <me> = "Garbage"
raises OutOfRange from Standard;
SetValue(me : mutable; where : Integer;
what : HExtendedString from TCollection)
---Level: Public
---Purpose: Replaces a part of <me> by another string.
raises OutOfRange from Standard;
Split(me : mutable; where : Integer)
returns HExtendedString from TCollection
---Purpose: Splits a ExtendedString into two sub-strings.
-- Example:
-- aString contains "abcdefg"
-- aString.Split(3) gives <me> = "abc" and returns "defg"
raises OutOfRange from Standard;
Search (me ; what : HExtendedString from TCollection) returns Integer;
---Level: Public
---Purpose: Searches a String in <me> from the beginning
-- and returns position of first item <what> matching.
-- It returns -1 if not found.
SearchFromEnd (me ; what : HExtendedString from TCollection) returns Integer;
---Level: Public
---Purpose: Searches a ExtendedString in another ExtendedString from the end
-- and returns position of first item <what> matching.
-- It returns -1 if not found.
ToExtString(me) returns ExtString;
---Level: Public
---Purpose: Returns pointer to ExtString
---C++: return const
Token (me ; separators : ExtString; whichone : Integer=1)
returns HExtendedString from TCollection
---Level: Public
---Purpose: Extracts <whichone> token from <me>.
-- By default, the <separators> is set to space and tabulation.
-- By default, the token extracted is the first one (whichone = 1).
-- <separators> contains all separators you need.
-- If no token indexed by <whichone> is found, it returns an empty String.
-- Example:
-- aString contains "This is a message"
-- aString.Token() returns "This"
-- aString.Token(" ",4) returns "message"
-- aString.Token(" ",2) returns "is"
-- aString.Token(" ",9) returns ""
-- Other separators than space character and tabulation are allowed
-- aString contains "1234; test:message , value"
-- aString.Token("; :,",4) returns "value"
-- aString.Token("; :,",2) returns "test"
raises NullObject from Standard;
Trunc (me : mutable ; ahowmany : Integer)
---Purpose: Truncates <me> to <ahowmany> characters.
-- Example: me = "Hello Dolly" -> Trunc(3) -> me = "Hel"
raises OutOfRange from Standard;
Value(me ; where : Integer) returns ExtCharacter
---Purpose: Returns ExtCharacter at position <where> in <me>.
-- If <where> is less than zero or greater than the length of
-- <me>, an exception is raised.
-- Example:
-- aString contains "Hello"
-- aString.Value(2) returns 'e'
raises OutOfRange from Standard;
String(me) returns ExtendedString from TCollection;
---Purpose: Returns the field myString
---C++: return const &
Print (me ; astream : out OStream);
---Purpose: Displays <me> .
IsSameState (me ; other : like me) returns Boolean;
---Level: Advanced
ChangeString(me) returns ExtendedString from TCollection is private;
---Purpose: Returns the field myString
---C++: return &
fields
myString : ExtendedString from TCollection;
end;

View File

@@ -14,11 +14,17 @@
//Modified: C. LEYNADIER Nov,21 1997 (Token et ChangeString)
#include <TCollection_AsciiString.hxx>
#include <TCollection_HExtendedString.ixx>
#include <TCollection_HAsciiString.hxx>
#include <Standard_ExtCharacter.hxx>
#include <Standard_ExtString.hxx>
#include <Standard_NegativeValue.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_NumericError.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TCollection_HExtendedString.hxx>
// ----------------------------------------------------------------------------
// Create

View File

@@ -0,0 +1,232 @@
// Created on: 1993-03-17
// Created by: Mireille MERCIEN
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TCollection_HExtendedString_HeaderFile
#define _TCollection_HExtendedString_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TCollection_ExtendedString.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_CString.hxx>
#include <Standard_ExtString.hxx>
#include <Standard_ExtCharacter.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_OStream.hxx>
class Standard_NullObject;
class Standard_OutOfRange;
class Standard_NumericError;
class Standard_NegativeValue;
class TCollection_ExtendedString;
class TCollection_HAsciiString;
class TCollection_HExtendedString;
DEFINE_STANDARD_HANDLE(TCollection_HExtendedString, MMgt_TShared)
//! A variable-length sequence of "extended"
//! (UNICODE) characters (16-bit character
//! type). It provides editing operations with
//! built-in memory management to make
//! ExtendedString objects easier to use than
//! ordinary extended character arrays.
//! HExtendedString objects are handles to strings.
//! - HExtendedString strings may be shared by several objects.
//! - You may use an ExtendedString object to get the actual string.
//! Note: HExtendedString objects use an
//! ExtendedString string as a field.
class TCollection_HExtendedString : public MMgt_TShared
{
public:
//! Initializes a HExtendedString to an empty ExtendedString.
Standard_EXPORT TCollection_HExtendedString();
//! Initializes a HExtendedString with a CString.
Standard_EXPORT TCollection_HExtendedString(const Standard_CString message);
//! Initializes a HExtendedString with an ExtString.
Standard_EXPORT TCollection_HExtendedString(const Standard_ExtString message);
//! Initializes a HExtendedString with a single character.
Standard_EXPORT TCollection_HExtendedString(const Standard_ExtCharacter aChar);
//! Initializes a HExtendedString with <length> space allocated.
//! and filled with <filler>.This is usefull for buffers.
Standard_EXPORT TCollection_HExtendedString(const Standard_Integer length, const Standard_ExtCharacter filler);
//! Initializes a HExtendedString with a HExtendedString.
Standard_EXPORT TCollection_HExtendedString(const TCollection_ExtendedString& aString);
//! Initializes a HExtendedString with an HAsciiString.
Standard_EXPORT TCollection_HExtendedString(const Handle(TCollection_HAsciiString)& aString);
//! Initializes a HExtendedString with a HExtendedString.
Standard_EXPORT TCollection_HExtendedString(const Handle(TCollection_HExtendedString)& aString);
//! Appends <other> to me.
Standard_EXPORT void AssignCat (const Handle(TCollection_HExtendedString)& other);
//! Returns a string appending <other> to me.
Standard_EXPORT Handle(TCollection_HExtendedString) Cat (const Handle(TCollection_HExtendedString)& other) const;
//! Substitutes all the characters equal to aChar by NewChar
//! in the string <me>.
Standard_EXPORT void ChangeAll (const Standard_ExtCharacter aChar, const Standard_ExtCharacter NewChar);
//! Removes all characters contained in <me>.
//! This produces an empty ExtendedString.
Standard_EXPORT void Clear();
//! Returns True if the string <me> contains zero character
Standard_EXPORT Standard_Boolean IsEmpty() const;
//! Insert a ExtCharacter at position <where>.
//! Example:
//! aString contains "hy not ?"
//! aString.Insert(1,'W'); gives "Why not ?"
//! aString contains "Wh"
//! aString.Insert(3,'y'); gives "Why"
//! aString contains "Way"
//! aString.Insert(2,'h'); gives "Why"
Standard_EXPORT void Insert (const Standard_Integer where, const Standard_ExtCharacter what);
//! Insert a HExtendedString at position <where>.
Standard_EXPORT void Insert (const Standard_Integer where, const Handle(TCollection_HExtendedString)& what);
//! Returns TRUE if <me> is less than <other>.
Standard_EXPORT Standard_Boolean IsLess (const Handle(TCollection_HExtendedString)& other) const;
//! Returns TRUE if <me> is greater than <other>.
Standard_EXPORT Standard_Boolean IsGreater (const Handle(TCollection_HExtendedString)& other) const;
//! Returns True if the string contains only "Ascii Range" characters
Standard_EXPORT Standard_Boolean IsAscii() const;
//! Returns number of characters in <me>.
//! This is the same functionality as 'strlen' in C.
Standard_EXPORT Standard_Integer Length() const;
//! Erases <ahowmany> characters from position <where>,
//! <where> included.
//! Example:
//! aString contains "Hello"
//! aString.Erase(2,2) erases 2 characters from position 1
//! This gives "Hlo".
Standard_EXPORT void Remove (const Standard_Integer where, const Standard_Integer ahowmany = 1);
//! Removes every <what> characters from <me>.
Standard_EXPORT void RemoveAll (const Standard_ExtCharacter what);
//! Replaces one character in the string at position <where>.
//! If <where> is less than zero or greater than the length of <me>
//! an exception is raised.
//! Example:
//! aString contains "Garbake"
//! astring.Replace(6,'g') gives <me> = "Garbage"
Standard_EXPORT void SetValue (const Standard_Integer where, const Standard_ExtCharacter what);
//! Replaces a part of <me> by another string.
Standard_EXPORT void SetValue (const Standard_Integer where, const Handle(TCollection_HExtendedString)& what);
//! Splits a ExtendedString into two sub-strings.
//! Example:
//! aString contains "abcdefg"
//! aString.Split(3) gives <me> = "abc" and returns "defg"
Standard_EXPORT Handle(TCollection_HExtendedString) Split (const Standard_Integer where);
//! Searches a String in <me> from the beginning
//! and returns position of first item <what> matching.
//! It returns -1 if not found.
Standard_EXPORT Standard_Integer Search (const Handle(TCollection_HExtendedString)& what) const;
//! Searches a ExtendedString in another ExtendedString from the end
//! and returns position of first item <what> matching.
//! It returns -1 if not found.
Standard_EXPORT Standard_Integer SearchFromEnd (const Handle(TCollection_HExtendedString)& what) const;
//! Returns pointer to ExtString
Standard_EXPORT const Standard_ExtString ToExtString() const;
//! Extracts <whichone> token from <me>.
//! By default, the <separators> is set to space and tabulation.
//! By default, the token extracted is the first one (whichone = 1).
//! <separators> contains all separators you need.
//! If no token indexed by <whichone> is found, it returns an empty String.
//! Example:
//! aString contains "This is a message"
//! aString.Token() returns "This"
//! aString.Token(" ",4) returns "message"
//! aString.Token(" ",2) returns "is"
//! aString.Token(" ",9) returns ""
//! Other separators than space character and tabulation are allowed
//! aString contains "1234; test:message , value"
//! aString.Token("; :,",4) returns "value"
//! aString.Token("; :,",2) returns "test"
Standard_EXPORT Handle(TCollection_HExtendedString) Token (const Standard_ExtString separators, const Standard_Integer whichone = 1) const;
//! Truncates <me> to <ahowmany> characters.
//! Example: me = "Hello Dolly" -> Trunc(3) -> me = "Hel"
Standard_EXPORT void Trunc (const Standard_Integer ahowmany);
//! Returns ExtCharacter at position <where> in <me>.
//! If <where> is less than zero or greater than the length of
//! <me>, an exception is raised.
//! Example:
//! aString contains "Hello"
//! aString.Value(2) returns 'e'
Standard_EXPORT Standard_ExtCharacter Value (const Standard_Integer where) const;
//! Returns the field myString
Standard_EXPORT const TCollection_ExtendedString& String() const;
//! Displays <me> .
Standard_EXPORT void Print (Standard_OStream& astream) const;
Standard_EXPORT Standard_Boolean IsSameState (const Handle(TCollection_HExtendedString)& other) const;
DEFINE_STANDARD_RTTI(TCollection_HExtendedString,MMgt_TShared)
protected:
private:
//! Returns the field myString
Standard_EXPORT TCollection_ExtendedString& ChangeString() const;
TCollection_ExtendedString myString;
};
#endif // _TCollection_HExtendedString_HeaderFile

View File

@@ -1,279 +0,0 @@
-- Created on: 1992-11-26
-- Created by: Mireille MERCIEN
-- Copyright (c) 1992-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class HSequence from TCollection
(Item as any;
TheSequence as any) -- Sequence from TCollection(Item))
inherits TShared from MMgt
---Purpose: A sequence of items indexed by an integer.
-- Sequences have about the same goal as unidimensional
-- arrays (TCollection_HArray1): they are commonly used
-- as elementary data structures for more complex objects.
-- But a sequence is a structure of variable size: sequences
-- avoid the use of large and quasi-empty arrays. Exploring
-- a sequence data structure is efficient when the exploration
-- is done in sequence; elsewhere a sequence item takes
-- longer to be read than an array item. Note also that
-- sequences are not efficient when they have to support
-- numerous algorithmic explorations: a map is better for that purpose.
-- HSequence objects are handles to sequences.
-- - HSequence sequences may be shared by several objects.
-- - You may use a TCollection_Sequence structure to
-- have the actual sequence.
-- HSequence is a generic class which depends on two parameters:
-- - Item, the type of element in the sequence,
-- - Seq, the actual type of sequence handled by
-- HSequence. This is an instantiation with Item of the
-- TCollection_Sequence generic class.A
raises
NoSuchObject from Standard,
OutOfRange from Standard
is
Create returns HSequence from TCollection;
---Purpose: Constructs an empty sequence.
-- Use:
-- - the function Append or Prepend to add an item or
-- a collection of items at the end, or at the beginning of the sequence,
-- - the function InsertAfter or InsertBefore to add an
-- item or a collection of items at any position in the sequence,
-- - the function SetValue or ChangeValue to assign a
-- new value to an item of the sequence,
-- - the function Value to read an item of the sequence,
-- - the function Remove to remove an item at any position in the sequence.
---C++: inline
IsEmpty(me) returns Boolean;
---Level: Public
---Purpose: returns True if the sequence <me> contains no elements.
---C++: inline
Length(me) returns Integer;
---Level: Public
---Purpose: Returns the number of element(s) in the
-- sequence. Returns zero if the sequence is empty.
--
---C++: inline
Clear(me : mutable);
---Level: Public
---Purpose: Removes all element(s) of the sequence <me>
-- Example:
-- before
-- me = (A B C)
-- after
-- me = ()
Append(me : mutable; anItem : Item);
---Level: Public
---Purpose: Appends <anItem> at the end of <me>.
-- Example:
-- before
-- me = (A B C)
-- after
-- me = (A B C anItem)
Append(me : mutable; aSequence : HSequence);
---Level: Public
---Purpose: Concatenates <aSequence> at the end of <me>.
-- Example:
-- before
-- me = (A B C)
-- aSequence = (D E F)
-- after
-- me = (A B C D E F)
-- aSequence = (D E F)
Prepend(me : mutable; anItem : Item);
---Level: Public
---Purpose: Add <anItem> at the beginning of <me>.
-- Example:
-- before
-- me = (A B C)
-- after
-- me = (anItem A B C )
Prepend(me : mutable; aSequence : HSequence);
---Purpose: Concatenates <aSequence> at the beginning of <me>.
-- Example:
-- before
-- me = (A B C)
-- aSequence = (D E F)
-- after me = (D E F A B C)
-- aSequence = (D E F)
Reverse(me : mutable);
---Purpose: Reverses the order of items on <me>.The first one becomes the last one and inversely.
-- Example:
-- before
-- me = (A B C)
-- after
-- me = (C B A)
InsertBefore(me : mutable; anIndex : Integer; anItem : Item)
raises OutOfRange from Standard;
---Purpose: Inserts <anItem> in <me> before the position <anIndex>.
-- Raises an exception if the anIndex is out of bounds.
-- Example:
-- before
-- me = (A B D), anIndex = 3, anItem = C
-- after
-- me = (A B C D )
InsertBefore(me : mutable ; anIndex : Integer; aSequence : HSequence)
raises OutOfRange from Standard;
---Purpose: Inserts the sequence <aSequence> in <me> before
-- the position <anIndex>.
-- Raises an exception if the anIndex is out of bounds.
-- Example:
-- before
-- me = (A B F), anIndex = 3, aSequence = (C D E)
-- after
-- me = (A B C D E F)
-- aSequence = (C D E)
InsertAfter(me : mutable; anIndex : Integer; anItem : Item)
raises OutOfRange from Standard;
---Purpose: Inserts <anItem> in <me> after the position
-- <anIndex>.
-- Raises an exception if anIndex is out of bound.
-- Example:
-- before
-- me = (A B C), anIndex = 3, anItem = D
-- after
-- me = (A B C D)
InsertAfter(me : mutable ; anIndex : Integer; aSequence : HSequence)
raises OutOfRange from Standard;
---Purpose: Inserts the sequence <aSequence> in <me>
-- after the position <anIndex>.
-- Raises an exception if anIndex is out of bound.
-- Example:
-- before
-- me = (A B C), anIndex = 3, aSequence = (D E F)
-- after
-- me = (A B C D E F)
-- aSequence = (D E F)
Exchange(me : mutable; anIndex, anOtherIndex : Integer)
raises OutOfRange from Standard;
---Purpose: Swaps elements which are located at
-- positions <anIndex> and <anOtherIndex> in <me>.
-- Raises an exception if anIndex or anOtherIndex is out of bound.
-- Example:
-- before
-- me = (A B C), anIndex = 1, anOtherIndex = 3
-- after
-- me = (C B A)
Split(me : mutable; anIndex : Integer)
returns HSequence
raises OutOfRange from Standard
---Purpose: Keeps in <me> the items 1 to <anIndex>-1 and
-- returns the items <anIndex> to the end.
-- Example:
-- before
-- me = (A B C D) ,anIndex = 3
-- after
-- me = (A B)
-- returns (C D)
is static;
SetValue(me : mutable; anIndex : Integer; anItem : Item)
raises OutOfRange from Standard
---Purpose: Sets <anItem> to be the item at position
-- <anIndex> in <me>.
-- Raises an exception if anIndex is out of bounds
-- Example:
-- before
-- me = (A B D), anIndex = 3, anItem = C
-- after
-- me = (A B C)
is static;
Value(me; anIndex : Integer) returns any Item
raises OutOfRange from Standard
---Purpose: Returns the Item at position <anIndex> in <me>.
-- Raises an exception if the anIndex is out of bound
-- Example:
-- before
-- me = (A B C), anIndex = 1
-- after
-- me = (A B C)
-- returns
-- A
---C++: return const &
is static;
ChangeValue(me : mutable; anIndex : Integer) returns any Item
raises OutOfRange from Standard
---Purpose: Returns the Item at position <anIndex> in <me>.
-- Raises an exception if the anIndex is out of bound.
-- Example:
-- before
-- me = (A B C), anIndex = 1
-- after
-- me = (A B C)
-- returns
-- A
---C++: return &
is static;
Remove(me : mutable; anIndex : Integer)
raises OutOfRange from Standard;
---Purpose: Removes from <me> the item at position
-- <anIndex>.
-- Raises an exception if anIndex is out of bounds.
-- Example:
-- before
-- me = (A B C), anIndex = 3
-- after
-- me = (A B)
Remove(me : mutable; fromIndex, toIndex : Integer)
raises OutOfRange from Standard;
---Purpose: Removes from <me> all the items of
-- positions between <fromIndex> and <toIndex>.
-- Raises an exception if the indices are out of bounds.
-- Example:
-- before
-- me = (A B C D E F), fromIndex = 1 toIndex = 3
-- after
-- me = (D E F)
Sequence(me) returns TheSequence;
---Purpose: Returns the Seq sequence used as a field by this
-- sequence; the returned sequence is not modifiable;
---C++: return const &
---C++: inline
ChangeSequence(me : mutable) returns TheSequence;
---Purpose: - Returns a modifiable reference on the Seq
-- sequence used as a field by this sequence, in order to modify it.
---C++: return &
---C++: inline
fields
mySequence : TheSequence;
end;

View File

@@ -1,228 +0,0 @@
-- Created on: 1993-01-08
-- Created by: Remi LEQUETTE
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class IndexedDataMap from TCollection
(TheKey as any;
TheItem as any;
Hasher as any) -- as MapHasher(TheKey)
inherits BasicMap from TCollection
---Purpose: An indexed map is used to store keys and to bind
-- an index to them. Each new key stored in the map
-- gets an index. Index are incremented as keys are
-- stored in the map. A key can be found by the index
-- and an index by the key. No key but the last can
-- be removed so the indices are in the range 1..
-- Extent. An Item is stored with each key.
--
-- This class is similar to IndexedMap from
-- TCollection with the Item as a new feature. Note
-- the important difference on the operator (). In
-- the IndexedMap this operator returns the Key. In
-- the IndexedDataMap this operator returns the Item.
-- An IndexedDataMap is an ordered
-- map, which allows a linear iteration on its contents. It
-- combines the behavior of:
-- - an array because data may be accessed with an index,
-- - and a map because data may also be accessed with a key.
-- IndexedDataMap is a generic class which depends on three parameters:
-- - Key is the type of key for an entry in the map,
-- - Item is the type of element associated with a key in the map,
-- - Hasher is the type of hasher on keys.
-- Notes:
-- - IndexedDataMap is similar to
-- TCollection_IndexedMap with the item as a new
-- feature. Note, however, the important difference with operator ():
-- - for an IndexedMap this operator returns the key, but
-- - for an IndexedDataMap it returns the item.
-- - It is recommended not to explore an IndexedDataMap
-- map with an iterator: you just use indexes.
-- - TCollection_MapHasher class describes the
-- functions required for a Hasher object.
raises
DomainError from Standard,
OutOfRange from Standard,
NoSuchObject from Standard
class IndexedDataMapNode from TCollection
inherits MapNode from TCollection
uses MapNodePtr from TCollection
is
Create(K1 : TheKey; K2 : Integer; I : TheItem; n1,n2 : MapNodePtr from TCollection) returns IndexedDataMapNode from TCollection;
---C++: inline
Key1(me) returns TheKey;
---C++: return &
---C++: inline
Key2(me) returns Integer;
---C++: return &
---C++: inline
Next2(me) returns MapNodePtr from TCollection;
---C++: return &
---C++: inline
Value(me) returns TheItem;
---C++: return &
---C++: inline
fields
myKey1 : TheKey;
myKey2 : Integer from Standard;
myValue : TheItem;
myNext2 : MapNodePtr from TCollection;
end;
is
Create(NbBuckets : Integer = 1) returns IndexedDataMap from TCollection;
---Purpose: Constructs an IndexedDataMap with NbBuckets
-- (defaulted to 1) buckets.
-- Note that the map will be automatically redimensioned
-- during its use if the number of entries becomes too large.
-- Use:
-- - the function Add to add an entry (key, item, index) in the map,
-- - operator() to read an item from an index, or to
-- assign a new value to this item,
-- - the function FindFromKey or ChangeFromKey to
-- read an item from a key, or to assign a new value to this item,
-- - the function RemoveLast to remove the last entry from the map,
-- - and other available edition and querying functions.
Create(Other : IndexedDataMap from TCollection)
returns IndexedDataMap from TCollection
---Purpose: As copying Map is an expensive operation it is
-- incorrect to do it implicitly. This constructor
-- will raise an error if the Map is not empty. To copy the
-- content of a Map use the Assign method (operator =).
raises DomainError from Standard
is private;
Assign(me : in out; Other : IndexedDataMap from TCollection)
returns IndexedDataMap from TCollection
---Purpose: Replace the content of this map by the content of
-- the map <Other>.
---C++: alias operator =
---C++: return &
is static;
ReSize(me : in out; NbBuckets : Integer)
---Purpose: Changes the number of buckets of <me> to be
-- <NbBuckets>. The entries (key + item + index) already
-- stored in this map are maintained.
is static;
Clear(me : in out)
---Purpose: Removes all keys in the map.
---C++: alias ~
is static;
Add(me : in out; K : TheKey; I : TheItem) returns Integer
---Purpose: Adds the Key <K> to the Map <me>. Returns the
-- index of the Key. The key is new in the map if
-- Extent has been incremented. The Item <I> is
-- stored with the key. If the key was already in the
-- map the previous item is not replaced by <I>.
is static;
Substitute(me : in out; I : Integer; K : TheKey; T : TheItem)
---Purpose: Substitutes the Key at index <I> with <K>. <I>
-- must be a valid index, <K> must be a new key. <T>
-- becomes the Item stored with <K>.
-- Trigger: Raises OutOfRange if I < 1 or I > Extent.
-- Raises DomainError if Contains(K).
raises
OutOfRange from Standard,
DomainError from Standard
is static;
RemoveLast(me : in out)
---Purpose: Removes the last key entered in the map, i.e the
-- key of index Extent().
-- I must be a valid index and K must be a new key.
-- Exceptions
-- - Standard_OutOfRange if the index I is less than 1 or
-- greater than the number of entries in this map.
-- - Standard_DomainError if the key K is already in this map.
raises
OutOfRange from Standard
is static;
Contains(me; K : TheKey) returns Boolean
---Purpose: Returns True if the key <K> is stored in the map <me>.
is static;
FindKey(me; I : Integer) returns any TheKey
---Purpose: Returns the Key of index <I>.
-- Exceptions
-- Standard_OutOfRange if I is less than 1 or greater than
-- the number of entries in this map.
---C++: return const &
raises OutOfRange from Standard
is static;
FindFromIndex(me; I : Integer) returns any TheItem
---Level: Public
---Purpose: Returns the Item of index <I>.
---Trigger: Raises OutOfRange if I < 1 or I > Extent
---C++: alias operator ()
---C++: return const &
raises OutOfRange from Standard
is static;
ChangeFromIndex(me : in out; I : Integer) returns any TheItem
---Level: Public
---Purpose: Returns the Item of index <I>. The Item can be
-- modified with the syntax aMap(Index) = newItem.
---Trigger: Raises OutOfRange if I < 1 or I > Extent
---C++: alias operator ()
---C++: return &
raises OutOfRange from Standard
is static;
FindIndex(me; K : TheKey) returns Integer
---Purpose: Returns the index of the key <K>.
-- Returns 0 if K is not in the map.
is static;
FindFromKey(me; K : TheKey) returns any TheItem
---Purpose: Returns the Item of the key <K>
-- Trigger: Raises NoSuchObject if K is not in the map.
raises NoSuchObject from Standard
---C++: return const &
is static;
ChangeFromKey(me : in out; K : TheKey) returns any TheItem
---Purpose: Returns the Item of the key <K>
-- Trigger: Raises NoSuchObject if K is not in the map.
raises NoSuchObject from Standard
---C++: return &
is static;
--modified by NIZNHY-PKV Tue Jul 05 08:38:26 2011f
FindFromKey1(me; K : TheKey)
returns Address from Standard;
---Purpose: Returns the address of Item of the key <K>
-- or NULL if K is not in the map.
ChangeFromKey1(me:out; K : TheKey)
returns Address from Standard;
---Purpose: Returns the address of Item of the key <K>
-- or NULL if K is not in the map.
--modified by NIZNHY-PKV Tue Jul 05 08:38:26 2011t
end IndexedDataMap;

View File

@@ -1,151 +0,0 @@
-- Created on: 1993-01-08
-- Created by: Remi LEQUETTE
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class IndexedMap from TCollection (TheKey as any;
Hasher as any) -- as MapHasher(TheKey)
inherits BasicMap from TCollection
---Purpose: An indexed map is used to store keys and to bind
-- an index to them. An index is assigned to each new key stored in the map.
-- Indexes incremented as keys are stored in the map. A key
-- can be found by the index, and an index by the key. No key
-- except for the last can be removed, so the indexes are in
-- the range 1..Upper where Upper is the number of
-- keys stored in the map.
-- An entry of an IndexedMap is composed of both the key
-- and the index. An IndexedMap is an ordered map, which
-- allows a linear iteration on its contents. But no data is
-- attached to the key. An IndexedMap is typically used by
-- an algorithm to know if some action is still performed on
-- components of a complex data structure.
-- IndexedMap is a generic class which depends on two parameters:
-- - Key is the type of key for an entry in the map,
-- - Hasher is the type of hasher on keys.
-- Notes:
-- - It is not recommended to explore an IndexedMap map
-- with an iterator: you just use indexes.
-- - TCollection_MapHasher class describes the
-- functions required for a Hasher object.
-- - TCollection_IndexedDataMap is a similar map with
-- an item as a new feature.
raises
DomainError from Standard,
OutOfRange from Standard
class IndexedMapNode from TCollection
inherits MapNode from TCollection
uses MapNodePtr from TCollection
is
Create(K1 : TheKey; K2 : Integer; n1,n2 : MapNodePtr from TCollection) returns IndexedMapNode from TCollection;
---C++: inline
Key1(me) returns TheKey;
---C++: return &
---C++: inline
Key2(me) returns Integer;
---C++: return &
---C++: inline
Next2(me) returns MapNodePtr from TCollection;
---C++: return &
---C++: inline
fields
myKey1 : TheKey;
myKey2 : Integer from Standard;
myNext2 : MapNodePtr from TCollection;
end;
is
Create(NbBuckets : Integer = 1) returns IndexedMap from TCollection;
---Purpose: Constructs an IndexedMap with NbBuckets (defaulted to 1) buckets.
-- Note that the map will be automatically redimensioned
-- during its use if the number of entries becomes too large.
-- Use:
-- - the function Add to add a new entry (key, index) to the map,
-- - operator() to read a key from an index,
-- - the function FindIndex to read an index from a key,
-- - the function RemoveLast to remove the last entry from the map.
Create(Other : IndexedMap from TCollection)
returns IndexedMap from TCollection;
---Purpose: As copying Map is an expensive operation it is
-- not recommended to do it implicitly.
Assign(me : in out; Other : IndexedMap from TCollection)
returns IndexedMap from TCollection
---Purpose: Replace the content of this map by the content of
-- the map <Other>.
---C++: alias operator =
---C++: return &
is static;
ReSize(me : in out; NbBuckets : Integer)
---Purpose: Changes the number of buckets of <me> to be
-- <NbBuckets>. The keys already stored in the map are kept.
is static;
Clear(me : in out)
---Purpose: Removes all keys in the map.
---C++: alias ~
is static;
Add(me : in out; K : TheKey) returns Integer
---Purpose: Adds the Key <K> to the Map <me>. Returns the
-- index of the Key. The key is new in the map if Extent
-- has been incremented.
is static;
Substitute(me : in out; I : Integer; K : TheKey)
---Purpose: Substitutes the Key at index <I> with <K>.
-- <I> must be a valid index, <K> must be a new key.
-- Trigger: Raises OutOfRange if I < 1 or I > Extent
-- Raises DomainError if Contains(K)
raises
OutOfRange from Standard,
DomainError from Standard
is static;
RemoveLast(me : in out)
---Purpose: Removes the last key entered in the map, i.e the
-- key of index Extent().
-- Trigger: Raises OutOfRange if Extent() == 0
raises
OutOfRange from Standard
is static;
Contains(me; K : TheKey) returns Boolean
---Level: Public
---Purpose: Returns True if the key <K> is stored in the map <me>.
is static;
FindKey(me; I : Integer) returns any TheKey
---Purpose: Returns the Key of index <I>.
-- Trigger: Raises OutOfRange if I < 1 or I > Extent
---C++: alias operator ()
---C++: return const &
raises OutOfRange from Standard
is static;
FindIndex(me; K : TheKey) returns Integer
---Purpose: Returns the index of the key <K> Returns 0 if K is
-- not in the map.
is static;
end IndexedMap;

View File

@@ -1,314 +0,0 @@
-- Created on: 1992-12-17
-- Created by: Remi LEQUETTE
-- Copyright (c) 1992-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class List from TCollection (Item as any)
---Purpose: Ordered lists of non-unique objects which can be
-- accessed sequentially using an iterator.
-- Item insertion in a list is very fast at any position. But
-- searching for items by value may be slow if the list is long,
-- because it requires a sequential search.
-- List is a generic class which depends on Item, the type of
-- element in the structure.
-- Use a ListIterator iterator to explore a List structure.
-- Notes:
-- - An iterator class is automatically instantiated from the
-- TCollection_ListIterator class at the time of
-- instantiation of a List structure.
-- - A sequence is a better structure when searching for
-- items by value is an important goal for a data structure.
-- - Queues and stacks are other kinds of list with a
-- different access to data.
uses
Address from Standard,
Boolean from Standard
raises
NoSuchObject from Standard
class ListNode from TCollection
inherits MapNode from TCollection
uses MapNodePtr from TCollection
is
Create(I : Item; n : MapNodePtr from TCollection) returns ListNode from TCollection;
---C++: inline
Value(me) returns Item;
---C++: return &
---C++: inline
fields
myValue : Item;
end;
class ListIterator
---Purpose: Functions used for iterating the contents of a List data structure.
-- A ListIterator object can be used to go through a list
-- sequentially, and to hold a position in a list as a
-- bookmark. It is not an index, however. Each step of the
-- iteration gives the current position of the iterator, to
-- which corresponds the current item in the list. The
-- current position is undefined if the list is empty, or when
-- the exploration is finished.
-- Note: an iterator class is automatically instantiated from
-- this generic class at the time of instantiation of a List
-- data structure.
raises
NoMoreObject from Standard,
NoSuchObject from Standard
is
Create returns ListIterator;
---Purpose: Constructs an empty iterator for a List data structure. Use
-- the function Initialize to define the list to explore.
Create(L : List) returns ListIterator;
---Purpose: Constructs an iterator on the list list, and positions it on
-- the first item of the list list, if it exists.
-- The current position is undefined if the list list is empty.
-- Use in a loop:
-- - the function More to know if there is a current item,
-- - then the function Value to read the value of the current item,
-- - then the function Next to position the iterator on the
-- next item, if it exists.
Initialize(me : in out; L : List)
---Purpose: Sets, or resets this iterator for the list list, and positions it
-- on the first item of the list list, if it exists.
-- The current position is undefined if the list list is empty.
-- Example
-- TColStd_ListOfInteger list;
-- TColStd_ListIteratorOfListOfInteger
-- pos;
-- pos.Initialize(list);
-- Use in a loop:
-- - the function More to know if there is a current item,
-- - then the function Value to read the value of the current item,
-- - then the function Next to position the iterator on the
-- next item, if it exists.
is static;
More(me) returns Boolean from Standard
---Purpose: Returns true if there is a current item in the list explored
-- with this iterator (i.e. when the current position is defined).
-- More is false if:
-- - the iterator is not initialized, or
-- - the list is empty, or
-- - the exploration is finished.
-- Use:
-- - the function Value to read the current item,
-- - the function Next to position this iterator on the next item, if it exists.
-- Example
-- Standard_Integer i;
-- TColStd_ListOfInteger s;
-- TColStd_ListIteratorOfListOfInteger
-- pos(s);
-- while(pos.More())
-- {
-- i = pos.Value();
-- pos.Next();
-- }
---C++: inline
is static;
Next(me : in out)
---Purpose: Sets this iterator on the next item in the explored list.
-- If the current position of this iterator corresponds to the
-- last item in the list, it becomes undefined.
-- Exceptions
-- Standard_NoMoreObject if the current position of this
-- iterator is undefined.
raises
NoMoreObject from Standard
is static;
Value(me) returns any Item
---Purpose: Returns the value of the current item of this iterator in the
-- explored list.
-- Note: Item is the type of element in the explored List list.
-- Example
-- TColStd_ListOfInteger s;
-- TColStd_ListIteratorOfListOfInteger
-- pos(s);
-- s.Append(1);
-- assert (pos.Value() == s.First() );
-- Exceptions
-- Standard_NoSuchObject if the current position of this
-- iterator is undefined.
---C++: return &
raises
NoSuchObject from Standard
is static;
fields
current : Address from Standard;
previous : Address from Standard;
friends
class List from TCollection
end ListIterator from TCollection;
is
Create returns List from TCollection;
---Purpose: Constructs an empty list.
-- Use:
-- - the function Append or Prepend to add an item or a
-- collection of items at the end, or at the beginning of the list,
-- - a list iterator to explore the list and read its items,
-- - and in conjunction with this iterator:
-- - the function InsertAfter or InsertBefore to add an
-- item or a collection of items at any position in the list,
-- - the function Remove to remove an item at any position in the list.
-- Warning
-- To copy a list, you must explicitly call the assignment operator (operator=).
Create(Other : List from TCollection)
returns List from TCollection;
---Purpose: Creation by copy of existing list.
-- We recommend to use the operator =.
Assign(me : in out; Other : List from TCollection)
---Purpose: Replace <me> by a copy of <Other>.
---C++: alias operator=
is static;
Extent(me) returns Integer
---Purpose: Returns the number of items.
is static;
Clear(me : in out)
---Purpose: Clears the content of the list <me>.
---C++: alias ~
is static;
IsEmpty(me) returns Boolean from Standard
---Purpose: Returns true if this list is empty.
---C++: inline
is static;
Prepend(me : in out; I : Item)
---Level: Public
---Purpose: Insert the Item <I> at the head of the list.
is static;
-- san: 18/04/2003 - addition methods returns ListIterator
Prepend(me : in out; I : Item; theIt : in out ListIterator )
---Level: Public
---Purpose: Insert the Item <I> at the head of the list.
--- Returns ListIterator pointing to the first Item.
is static;
Prepend(me : in out; Other : in out List from TCollection)
---Level: Public
---Purpose: Insert the list <Other> at the head of <me>.
--- <Other> is cleared.
is static;
Append(me : in out; I : Item)
---Level: Public
---Purpose: Insert the Item <I> at the end of the list.
is static;
-- san: 18/04/2003 - addition methods returns ListIterator
Append(me : in out; I : Item; theIt : in out ListIterator )
---Level: Public
---Purpose: Insert the Item <I> at the head of the list.
--- Returns ListIterator pointing to the first Item.
is static;
Append(me : in out; Other : in out List from TCollection)
---Level: Public
---Purpose: Append the list <L> at the end of <me>.
--- <Other> is cleared.
is static;
First(me) returns any Item
---Purpose: Returns the first Item in the list, may be modified.
-- Trigger: Raises an exception when the list is empty.
---C++: return &
raises
NoSuchObject from Standard
is static;
Last(me) returns any Item
---Purpose: Returns the last Item in the list, may be modified.
-- Trigger: Raises an exception when the list is empty.
---C++: return &
raises
NoSuchObject from Standard
is static;
RemoveFirst(me : in out)
---Purpose: Removes the first Item from the list. Nothing is
-- done if the list is empty.
is static;
Remove(me : in out; It : in out ListIterator)
---Purpose: Removes the current Item of the ListIterator from the
-- List. The ListIterator current will be the next Item
-- in the list.
-- Exceptions
-- Standard_NoSuchObject if the current position of the
-- list iterator pos is undefined.
raises
NoSuchObject from Standard
is static;
InsertBefore (me : in out; I : Item;
It : in out ListIterator)
---Level: Public
---Purpose: Insert <I> in the List before the current position
-- of <It>. It is not change.
raises
NoSuchObject from Standard
is static;
InsertBefore (me : in out; Other : in out List from TCollection;
It : in out ListIterator)
---Level: Public
---Purpose: Insert <Other> in the List before the current position
-- of <It>. <It> is not change. <Other> is cleared.
raises
NoSuchObject from Standard
is static;
InsertAfter (me : in out; I : Item;
It : in out ListIterator)
---Level: Public
---Purpose: Insert <I> in the List after the current position
-- if <It>. <It> is not changed.
is static;
InsertAfter (me : in out; Other : in out List from TCollection;
It : in out ListIterator)
---Level: Public
---Purpose: Insert <Other> in the List after the current position
-- if <It>. <It> is not changed. <Other> is cleared.
is static;
fields
myFirst : Address from Standard;
myLast : Address from Standard;
friends
class ListIterator from TCollection
end List;

View File

@@ -1,165 +0,0 @@
-- Created on: 1993-01-07
-- Created by: Remi LEQUETTE
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class Map from TCollection (TheKey as any;
Hasher as any) -- as MapHasher(TheKey)
inherits BasicMap from TCollection
---Purpose: Basic hashed Map. This Map is used to store and
-- retrieve keys in linear time.
--
-- The MapIterator class can be used to explore the
-- content of the map. It is not wise to iterate and
-- modify a map in parallel.
--
-- The Hasher argument is used to computes the
-- hashcode of key and compare two keys.
--
-- The performance of a Map is conditionned by its
-- number of buckets that should be kept greater to
-- the number of keys. This map has an automatic
-- management of the number of buckets. It is resized
-- when the number of Keys becomes greater than the
-- number of buckets.
--
-- If you have a fair idea of the number of objects
-- you can save on automatic resizing by giving a
-- number of buckets at creation or using the ReSize
-- method. This should be consider only for crucial
-- optimisation issues.
-- An entry of a Map is composed of the key only. No data is
-- attached to the key. A Map is typically used by an
-- algorithm to know if some action is still performed on
-- components of a complex data structure.
-- Map is a generic class which depends on two parameters:
-- - Key is the type of key in the map,
-- - Hasher is the type of hasher on keys.
-- Use a MapIterator iterator to explore a Map map.
-- Notes:
-- - An iterator class is automatically instantiated from the
-- TCollection_MapIterator class at the time of
-- instantiation of a Map map.
-- - TCollection_MapHasher class describes the
-- functions required for a Hasher object.
class StdMapNode from TCollection
inherits MapNode from TCollection
uses MapNodePtr from TCollection
is
Create(K : TheKey; n : MapNodePtr from TCollection) returns StdMapNode from TCollection;
---C++: inline
Key(me) returns TheKey;
---C++: return &
---C++: inline
fields
myKey : TheKey;
end;
class MapIterator inherits BasicMapIterator from TCollection
---Purpose: Provides iteration on the content of a map. The
-- iteration methods are inherited from the
-- BasicMapIterator.
-- Note: an iterator class is automatically instantiated from
-- this generic class at the time of instantiation of a <Map>.
-- Warning
-- - A map is a non-ordered data structure. The order in
-- which entries of a map are explored by the iterator
-- depends on its contents, and changes when the map is edited.
-- - It is not recommended to modify the contents of a map
-- during iteration: the result is unpredictable.
raises NoSuchObject from Standard
is
Create returns MapIterator from TCollection;
---Purpose: Creates an empty iterator for a Map map; use the function
-- Initialize to define the map to explore;
Create (aMap : Map from TCollection)
returns MapIterator from TCollection;
---Purpose: Creates an Iterator on the map <aMap>.
Initialize(me : in out; aMap : Map from TCollection)
---Purpose: Sets or resets the Iterator in the map <aMap>.
is static;
Key(me) returns any TheKey
---Purpose: Returns the current Key. An error is raised if
-- the iterator is empty (More returns False).
-- Note: Key is the type of key for an entry in the explored <Map>.
-- Exceptions
-- Standard_NoSuchObject if this iterator is empty (i.e.
-- when the function More returns false).
---C++: return const &
raises
NoSuchObject from Standard
is static;
end MapIterator from TCollection;
is
Create(NbBuckets : Integer = 1) returns Map from TCollection;
---Purpose: Constructs a Map with NbBuckets (defaulted to 1) buckets.
-- Note that the map will be automatically redimensioned
-- during its use if the number of entries becomes too large.
-- Use:
-- - the function Add to add a new key in the map,
-- - the function Remove to remove a key from the map,
-- - and a map iterator to explore the map.
Create(Other : Map from TCollection) returns Map from TCollection;
---Purpose: As copying Map is an expensive operation it is
-- not recommended to do it implicitly.
Assign(me : in out; Other : Map from TCollection)
returns Map from TCollection
---Purpose: Replace the content of this map by the content of
-- the map <Other>.
---C++: alias operator =
---C++: return &
is static;
ReSize(me : in out; NbBuckets : Integer)
---Purpose: Changes the number of buckets of <me> to be
-- <NbBuckets>. The keys already stored in the map are kept.
is static;
Clear(me : in out)
---Purpose: Removes all keys in the map.
---C++: alias ~
is static;
Add(me : in out; aKey : TheKey) returns Boolean
---Purpose: Adds the Key <aKey> to the Map <me>. Returns True
-- if the Key was not already in the Map.
is static;
Contains(me; aKey : TheKey) returns Boolean
---Purpose: Returns True if the key <aKey> is stored in the
-- map <me>.
is static;
Remove(me : in out; aKey : TheKey) returns Boolean
---Purpose: Removes the Key <aKey> from the map. Returns True
-- if the Key was in the Map.
is static;
end Map;

View File

@@ -1,59 +0,0 @@
-- Created on: 1993-01-07
-- Created by: Remi LEQUETTE
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class MapHasher from TCollection (Key as any)
---Purpose: A hasher on the keys of a map instantiated from the
-- Collections component.
-- A hasher provides two functions:
-- - The hashing function (HashCode) transforms a key
-- into a bucket index in the map. The number of values
-- that can be computed by the hashing function is equal
-- to the number of buckets in the map.
-- - IsEqual is the equality test between two keys.
-- Hashers are used as parameters in generic maps
-- provided by the Collections component.
-- MapHasher is a generic class which depends on the type
-- of keys, provided that Key is a type from the Standard
-- package. In such cases MapHasher may be directly
-- instantiated with Key. Note that the package TColStd
-- provides some of these instantiations.
-- But if Key is not a type from the Standard package you
-- must consider MapHasher as a template and build a class
-- which includes its functions, in order to use it as a hasher
-- in a map instantiated from the Collections component.
-- Note that TCollection_AsciiString and
-- TCollection_ExtendedString classes correspond to
-- these specifications, in consequence they may be used as
-- hashers: when Key is one of these two types you may just
-- define the hasher as the same type at the time of
-- instantiation of your map.
is
HashCode(myclass; K : Key; Upper : Integer) returns Integer;
---Level: Public
---Purpose: Returns a HasCode value for the Key <K> in the
-- range 0..Upper.
-- Default ::HashCode(K,Upper)
IsEqual(myclass; K1, K2 : Key) returns Boolean;
---Level: Public
---Purpose: Returns True when the two keys are the same. Two
-- same keys must have the same hashcode, the
-- contrary is not necessary.
-- Default K1 == K2
end MapHasher;

View File

@@ -1,33 +0,0 @@
-- Created on: 1998-01-19
-- Created by: Kernel
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
private class MapNode from TCollection
---Purpose: Basic class root of all the Maps.
inherits TShared from MMgt
uses MapNodePtr from TCollection
is
Create(n : MapNodePtr from TCollection) returns MapNode from TCollection;
---C++: inline
Next(me) returns MapNodePtr from TCollection;
---C++: inline
---C++: return &
fields
myNext : MapNodePtr from TCollection;
end;

View File

@@ -12,4 +12,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TCollection_MapNode.ixx>
#include <Standard_Type.hxx>
#include <TCollection_MapNode.hxx>

View File

@@ -0,0 +1,66 @@
// Created on: 1998-01-19
// Created by: Kernel
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TCollection_MapNode_HeaderFile
#define _TCollection_MapNode_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TCollection_MapNodePtr.hxx>
#include <MMgt_TShared.hxx>
class TCollection_MapNode;
DEFINE_STANDARD_HANDLE(TCollection_MapNode, MMgt_TShared)
//! Basic class root of all the Maps.
class TCollection_MapNode : public MMgt_TShared
{
public:
TCollection_MapNode(const TCollection_MapNodePtr& n);
TCollection_MapNodePtr& Next() const;
DEFINE_STANDARD_RTTI(TCollection_MapNode,MMgt_TShared)
protected:
private:
TCollection_MapNodePtr myNext;
};
#include <TCollection_MapNode.lxx>
#endif // _TCollection_MapNode_HeaderFile

View File

@@ -0,0 +1,23 @@
// Created on: 1992-10-13
// Created by: Ramin BARRETO
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TCollection_MapNodePtr_HeaderFile
#define _TCollection_MapNodePtr_HeaderFile
class TCollection_MapNode;
typedef TCollection_MapNode* TCollection_MapNodePtr;
#endif // _TCollection_MapNodePtr_HeaderFile

View File

@@ -1,35 +0,0 @@
-- Created on: 1998-01-21
-- Created by: Kernel
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class SeqNode from TCollection
inherits TShared from MMgt
uses SeqNodePtr from TCollection
is
Create(n,p : SeqNodePtr from TCollection) returns SeqNode from TCollection;
---C++: inline
Next(me) returns SeqNodePtr from TCollection;
---C++: inline
---C++: return &
Previous(me) returns SeqNodePtr from TCollection;
---C++: inline
---C++: return &
fields
myNext : SeqNodePtr from TCollection;
myPrevious : SeqNodePtr from TCollection;
end;

View File

@@ -12,4 +12,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TCollection_SeqNode.ixx>
#include <Standard_Type.hxx>
#include <TCollection_SeqNode.hxx>

View File

@@ -0,0 +1,69 @@
// Created on: 1998-01-21
// Created by: Kernel
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TCollection_SeqNode_HeaderFile
#define _TCollection_SeqNode_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TCollection_SeqNodePtr.hxx>
#include <MMgt_TShared.hxx>
class TCollection_SeqNode;
DEFINE_STANDARD_HANDLE(TCollection_SeqNode, MMgt_TShared)
class TCollection_SeqNode : public MMgt_TShared
{
public:
TCollection_SeqNode(const TCollection_SeqNodePtr& n, const TCollection_SeqNodePtr& p);
TCollection_SeqNodePtr& Next() const;
TCollection_SeqNodePtr& Previous() const;
DEFINE_STANDARD_RTTI(TCollection_SeqNode,MMgt_TShared)
protected:
private:
TCollection_SeqNodePtr myNext;
TCollection_SeqNodePtr myPrevious;
};
#include <TCollection_SeqNode.lxx>
#endif // _TCollection_SeqNode_HeaderFile

View File

@@ -0,0 +1,23 @@
// Created on: 1992-10-13
// Created by: Ramin BARRETO
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TCollection_SeqNodePtr_HeaderFile
#define _TCollection_SeqNodePtr_HeaderFile
class TCollection_SeqNode;
typedef TCollection_SeqNode* TCollection_SeqNodePtr;
#endif // _TCollection_SeqNodePtr_HeaderFile

View File

@@ -1,304 +0,0 @@
-- Created on: 1992-09-11
-- Created by: Mireille MERCIEN
-- Copyright (c) 1992-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class Sequence from TCollection (SeqItem as any)
inherits BaseSequence from TCollection
---Purpose: A sequence of items indexed by an integer.
-- Sequences have approximately the same goal as
-- unidimensional arrays (TCollection_Array1): they are
-- commonly used as elementary data structures for more
-- complex objects. But a sequence is a structure of
-- variable size: sequences avoid the use of large and
-- quasi-empty arrays. Exploring a sequence data
-- structure is performant when the exploration is done in
-- sequence; elsewhere a sequence item is longer to read
-- than an array item. Note also that sequences are not
-- performant when they have to support numerous
-- algorithmic explorations: a map is better for that.
-- Sequence is a generic class which depends on Item,
-- the type of element in the sequence.
raises
NoSuchObject from Standard,
OutOfRange from Standard
class SequenceNode from TCollection
inherits SeqNode from TCollection
uses SeqNodePtr from TCollection
is
Create(I : SeqItem; n,p : SeqNodePtr from TCollection) returns SequenceNode from TCollection;
---C++: inline
Value(me) returns SeqItem;
---C++: return &
---C++: inline
fields
myValue : SeqItem;
end;
is
Create returns Sequence;
---Purpose: Constructs an empty sequence.
-- Use:
-- - the function Append or Prepend to add an item or
-- a collection of items at the end, or at the beginning of the sequence,
-- - the function InsertAfter or InsertBefore to add an
-- item or a collection of items at any position in the sequence,
-- - operator() or the function SetValue to assign a
-- new value to an item of the sequence,
-- - operator() to read an item of the sequence,
-- - the function Remove to remove an item at any
-- position in the sequence.
-- Warning
-- To copy a sequence, you must explicitly call the
-- assignment operator (operator=).
---C++: inline
Create(Other : Sequence) returns Sequence from TCollection;
---Purpose: Creation by copy of existing Sequence.
Clear(me : in out);
---Purpose: Removes all element(s) of the sequence <me>
-- Example:
-- before
-- me = (A B C)
-- after
-- me = ()
--
---C++: alias ~
Assign(me : in out; Other : Sequence) returns Sequence from TCollection
---Purpose: Copies the contents of the sequence Other into this sequence.
-- If this sequence is not empty, it is automatically cleared before the copy.
---C++: alias operator =
---C++: return const &
is static;
Append(me : in out; T : SeqItem);
---Level: Public
---Purpose: Appends <T> at the end of <me>.
-- Example:
-- before
-- me = (A B C)
-- after
-- me = (A B C T)
Append(me : in out; S : in out Sequence)
---Level: Public
---Purpose: Concatenates <S> at the end of <me>.
-- <S> is cleared.
-- Example:
-- before
-- me = (A B C)
-- S = (D E F)
-- after
-- me = (A B C D E F)
-- S = ()
--
---C++: inline
is static;
Prepend(me : in out; T : SeqItem);
---Level: Public
---Purpose: Add <T> at the beginning of <me>.
-- Example:
-- before
-- me = (A B C)
-- after
-- me = (T A B C )
Prepend(me : in out; S : in out Sequence);
---Level: Public
---Purpose: Concatenates <S> at the beginning of <me>.
-- <S> is cleared.
-- Example:
-- before
-- me = (A B C) S = (D E F)
-- after me = (D E F A B C)
-- S = ()
--
---C++: inline
InsertBefore(me : in out; Index : Integer from Standard; T : SeqItem)
raises OutOfRange from Standard;
---Level: Public
---Purpose: Inserts <T> in <me> before the position <Index>.
-- Raises an exception if the index is out of bounds.
-- Example:
-- before
-- me = (A B D), Index = 3, T = C
-- after
-- me = (A B C D )
--
---C++: inline
InsertBefore(me : in out ; Index : Integer from Standard; S : in out Sequence)
raises OutOfRange from Standard;
---Level: Public
---Purpose: Inserts the sequence <S> in <me> before
-- the position <Index>. <S> is cleared.
-- Raises an exception if the index is out of bounds
-- Example:
-- before
-- me = (A B F), Index = 3, S = (C D E)
-- after
-- me = (A B C D E F)
-- S = ()
--
---C++: inline
InsertAfter(me : in out; Index : Integer from Standard; T : SeqItem)
raises OutOfRange from Standard;
---Level: Public
---Purpose: Inserts <T> in <me> after the position <Index>.
-- Raises an exception if the index is out of bound
-- Example:
-- before
-- me = (A B C), Index = 3, T = D
-- after
-- me = (A B C D)
InsertAfter(me : in out; Index : Integer from Standard; S : in out Sequence)
raises OutOfRange from Standard;
---Level: Public
---Purpose: Inserts the sequence <S> in <me> after the
-- position <Index>. <S> is cleared.
-- Raises an exception if the index is out of bound.
-- Example:
-- before
-- me = (A B C), Index = 3, S = (D E F)
-- after
-- me = (A B C D E F)
-- S = ()
--
---C++: inline
First(me) returns any SeqItem
raises NoSuchObject from Standard
---Level: Public
---Purpose: Returns the first element of the sequence <me>
-- Raises an exception if the sequence is empty.
-- Example:
-- before
-- me = (A B C)
-- after
-- me = (A B C)
-- returns A
---C++: return const &
is static;
Last(me) returns any SeqItem
raises NoSuchObject from Standard
---Level: Public
---Purpose: Returns the last element of the sequence <me>
-- Raises an exception if the sequence is empty.
-- Example:
-- before
-- me = (A B C)
-- after
-- me = (A B C)
-- returns C
---C++: return const &
is static;
Split(me : in out; Index : Integer from Standard; Sub : in out Sequence)
raises OutOfRange from Standard;
---Level: Public
---Purpose: Keeps in <me> the items 1 to <Index>-1 and
-- puts in <Sub> the items <Index> to the end.
-- Example:
-- before
-- me = (A B C D) ,Index = 3
-- after
-- me = (A B)
-- Sub = (C D)
--
---C++: inline
Value(me; Index : Integer from Standard) returns any SeqItem
raises OutOfRange from Standard;
---Level: Public
---Purpose: Returns the Item at position <Index> in <me>.
-- Raises an exception if the index is out of bound
-- Example:
-- before
-- me = (A B C), Index = 1
-- after
-- me = (A B C)
-- returns
-- A
---C++: return const &
---C++: alias operator()
SetValue(me : in out; Index : Integer from Standard; I : SeqItem)
raises OutOfRange from Standard;
---Level: Public
---Purpose: Changes the item at position <Index>
-- Raises an exception if the index is out of bound
-- Example:
-- before
-- me = (A B C), Index = 1, Item = D
-- after
-- me = (D B C)
--
ChangeValue(me : in out; Index : Integer from Standard) returns any SeqItem
raises OutOfRange from Standard;
---Level: Public
---Purpose: Returns the Item at position <Index> in
-- <me>. This method may be used to modify
-- <me> : S.Value(Index) = Item.
-- Raises an exception if the index is out of bound
-- Example:
-- before
-- me = (A B C), Index = 1
-- after
-- me = (A B C)
-- returns
-- A
---C++: return &
---C++: alias operator()
Remove(me : in out; Index : Integer from Standard)
raises OutOfRange from Standard;
---Level: Public
---Purpose: Removes from <me> the item at position <Index>.
-- Raises an exception if the index is out of bounds
-- Example:
-- before
-- me = (A B C), Index = 3
-- after
-- me = (A B)
Remove(me : in out; FromIndex, ToIndex : Integer from Standard)
raises OutOfRange from Standard;
---Level: Public
---Purpose: Removes from <me> all the items of
-- positions between <FromIndex> and <ToIndex>.
-- Raises an exception if the indices are out of bounds.
-- Example:
-- before
-- me = (A B C D E F), FromIndex = 1 ToIndex = 3
-- after
-- me = (D E F)
end;

View File

@@ -0,0 +1,27 @@
// Created on: 1992-10-13
// Created by: Ramin BARRETO
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TCollection_Side_HeaderFile
#define _TCollection_Side_HeaderFile
enum TCollection_Side
{
TCollection_Left,
TCollection_Right
};
#endif // _TCollection_Side_HeaderFile

View File

@@ -1,24 +0,0 @@
-- Created by: Stephane Callegari
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
@ifnotdefined ( %TCollection_WOKSteps_EDL) then
@set %TCollection_WOKSteps_EDL = "";
@string %WOKSteps_XcppGroup = " xcpp.fill xcpp.src xcpp.header xcpp.template obj.cgen obj.inc ";
--@set %WOKSteps_xcpp_repl = "*TCollection_Replace(xcpp.header)";
@endif;