Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:06

0001 // Created on: 1997-01-03
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1997-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _StepData_PDescr_HeaderFile
0018 #define _StepData_PDescr_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TCollection_AsciiString.hxx>
0024 #include <Standard_Integer.hxx>
0025 #include <StepData_EnumTool.hxx>
0026 #include <Standard_Transient.hxx>
0027 #include <Standard_CString.hxx>
0028 class StepData_EDescr;
0029 class StepData_Field;
0030 class Interface_Check;
0031 
0032 
0033 class StepData_PDescr;
0034 DEFINE_STANDARD_HANDLE(StepData_PDescr, Standard_Transient)
0035 
0036 //! This class is intended to describe the authorized form for a
0037 //! parameter, as a type or a value for a field
0038 //!
0039 //! A PDescr firstly describes a type, which can be SELECT, i.e.
0040 //! have several members
0041 class StepData_PDescr : public Standard_Transient
0042 {
0043 
0044 public:
0045 
0046   
0047   Standard_EXPORT StepData_PDescr();
0048   
0049   Standard_EXPORT void SetName (const Standard_CString name);
0050   
0051   Standard_EXPORT Standard_CString Name() const;
0052   
0053   //! Declares this PDescr to be a Select, hence to have members
0054   //! <me> itself can be the first member
0055   Standard_EXPORT void SetSelect();
0056   
0057   //! Adds a member to a SELECT description
0058   Standard_EXPORT void AddMember (const Handle(StepData_PDescr)& member);
0059   
0060   //! Sets a name for SELECT member. To be used if a member is for
0061   //! an immediate type
0062   Standard_EXPORT void SetMemberName (const Standard_CString memname);
0063   
0064   //! Sets <me> for an Integer value
0065   Standard_EXPORT void SetInteger();
0066   
0067   //! Sets <me> for a Real value
0068   Standard_EXPORT void SetReal();
0069   
0070   //! Sets <me> for a String value
0071   Standard_EXPORT void SetString();
0072   
0073   //! Sets <me> for a Boolean value (false,true)
0074   Standard_EXPORT void SetBoolean();
0075   
0076   //! Sets <me> for a Logical value (false,true,unknown)
0077   Standard_EXPORT void SetLogical();
0078   
0079   //! Sets <me> for an Enum value
0080   //! Then, call AddEnumDef ordered from the first one (value 0)
0081   Standard_EXPORT void SetEnum();
0082   
0083   //! Adds an enum value as a string
0084   Standard_EXPORT void AddEnumDef (const Standard_CString enumdef);
0085   
0086   //! Sets <me> for an Entity which must match a Type (early-bound)
0087   Standard_EXPORT void SetType (const Handle(Standard_Type)& atype);
0088   
0089   //! Sets <me> for a Described Entity, whose Description must match
0090   //! the type name  <dscnam>
0091   Standard_EXPORT void SetDescr (const Standard_CString dscnam);
0092   
0093   //! Adds an arity count to <me>, by default 1
0094   //! 1 : a simple field passes to a LIST/ARRAY etc
0095   //! or a LIST to a LIST OF LIST
0096   //! 2 : a simple field passes to a LIST OF LIST
0097   Standard_EXPORT void AddArity (const Standard_Integer arity = 1);
0098   
0099   //! Directly sets the arity count
0100   //! 0 : simple field
0101   //! 1 : LIST or ARRAY etc
0102   //! 2 : LIST OF LIST
0103   Standard_EXPORT void SetArity (const Standard_Integer arity = 1);
0104   
0105   //! Sets <me> as <other> but duplicated
0106   //! Hence, some definition may be changed
0107   Standard_EXPORT void SetFrom (const Handle(StepData_PDescr)& other);
0108   
0109   //! Sets/Unsets <me> to accept undefined values
0110   Standard_EXPORT void SetOptional (const Standard_Boolean opt = Standard_True);
0111   
0112   //! Sets/Unsets <me> to be for a derived field
0113   Standard_EXPORT void SetDerived (const Standard_Boolean der = Standard_True);
0114   
0115   //! Sets <me> to describe a field of an entity
0116   //! With a name and a rank
0117   Standard_EXPORT void SetField (const Standard_CString name, const Standard_Integer rank);
0118   
0119   //! Tells if <me> is for a SELECT
0120   Standard_EXPORT Standard_Boolean IsSelect() const;
0121   
0122   //! For a SELECT, returns the member whose name matches <name>
0123   //! To this member, the following question can then be asked
0124   //! Null Handle if <name> not matched or <me> not a SELECT
0125   //!
0126   //! Remark : not to be asked for an entity type
0127   //! Hence, following IsInteger .. Enum* only apply on <me> and
0128   //! require Member
0129   //! While IsType applies on <me> and all Select Members
0130   Standard_EXPORT Handle(StepData_PDescr) Member (const Standard_CString name) const;
0131   
0132   //! Tells if <me> is for an Integer
0133   Standard_EXPORT Standard_Boolean IsInteger() const;
0134   
0135   //! Tells if <me> is for a Real value
0136   Standard_EXPORT Standard_Boolean IsReal() const;
0137   
0138   //! Tells if <me> is for a String value
0139   Standard_EXPORT Standard_Boolean IsString() const;
0140   
0141   //! Tells if <me> is for a Boolean value (false,true)
0142   Standard_EXPORT Standard_Boolean IsBoolean() const;
0143   
0144   //! Tells if <me> is for a Logical value (false,true,unknown)
0145   Standard_EXPORT Standard_Boolean IsLogical() const;
0146   
0147   //! Tells if <me> is for an Enum value
0148   //! Then, call AddEnumDef ordered from the first one (value 0)
0149   //! Managed by an EnumTool
0150   Standard_EXPORT Standard_Boolean IsEnum() const;
0151   
0152   //! Returns the maximum integer for a suitable value (count - 1)
0153   Standard_EXPORT Standard_Integer EnumMax() const;
0154   
0155   //! Returns the numeric value found for an enum text
0156   //! The text must be in capitals and limited by dots
0157   //! A non-suitable text gives a negative value to be returned
0158   Standard_EXPORT Standard_Integer EnumValue (const Standard_CString name) const;
0159   
0160   //! Returns the text which corresponds to a numeric value,
0161   //! between 0 and EnumMax. It is limited by dots
0162   Standard_EXPORT Standard_CString EnumText (const Standard_Integer val) const;
0163   
0164   //! Tells if <me> is for an Entity, either Described or CDL Type
0165   Standard_EXPORT Standard_Boolean IsEntity() const;
0166   
0167   //! Tells if <me> is for an entity of a given CDL type (early-bnd)
0168   //! (works for <me> + nexts if <me> is a Select)
0169   Standard_EXPORT Standard_Boolean IsType (const Handle(Standard_Type)& atype) const;
0170   
0171   //! Returns the type to match (IsKind), for a CDL Entity
0172   //! (else, null handle)
0173   Standard_EXPORT Handle(Standard_Type) Type() const;
0174   
0175   //! Tells if <me> is for a Described entity of a given EDescr
0176   //! (does this EDescr match description name ?). For late-bnd
0177   //! (works for <me> + nexts if <me> is a Select)
0178   Standard_EXPORT Standard_Boolean IsDescr (const Handle(StepData_EDescr)& descr) const;
0179   
0180   //! Returns the description (type name) to match, for a Described
0181   //! (else, empty string)
0182   Standard_EXPORT Standard_CString DescrName() const;
0183   
0184   //! Returns the arity of <me>
0185   Standard_EXPORT Standard_Integer Arity() const;
0186   
0187   //! For a LIST or LIST OF LIST, Returns the PDescr for the simpler
0188   //! PDescr. Else, returns <me>
0189   //! This allows to have different attributes for Optional for
0190   //! instance, on a field, and on the parameter of a LIST :
0191   //! [OPTIONAL] LIST OF [OPTIONAL] ...
0192   Standard_EXPORT Handle(StepData_PDescr) Simple() const;
0193   
0194   //! Tells if <me> is Optional
0195   Standard_EXPORT Standard_Boolean IsOptional() const;
0196   
0197   //! Tells if <me> is Derived
0198   Standard_EXPORT Standard_Boolean IsDerived() const;
0199   
0200   //! Tells if <me> is a Field. Else it is a Type
0201   Standard_EXPORT Standard_Boolean IsField() const;
0202   
0203   Standard_EXPORT Standard_CString FieldName() const;
0204   
0205   Standard_EXPORT Standard_Integer FieldRank() const;
0206   
0207   //! Semantic Check of a Field : does it complies with the given
0208   //! description ?
0209   Standard_EXPORT virtual void Check (const StepData_Field& afild, Handle(Interface_Check)& ach) const;
0210 
0211 
0212 
0213 
0214   DEFINE_STANDARD_RTTIEXT(StepData_PDescr,Standard_Transient)
0215 
0216 protected:
0217 
0218 
0219 
0220 
0221 private:
0222 
0223   
0224   Standard_EXPORT Standard_Integer Kind() const;
0225 
0226   TCollection_AsciiString thename;
0227   Standard_Integer thesel;
0228   TCollection_AsciiString thesnam;
0229   Handle(StepData_PDescr) thenext;
0230   Standard_Integer thekind;
0231   StepData_EnumTool theenum;
0232   Handle(Standard_Type) thetype;
0233   TCollection_AsciiString thednam;
0234   Standard_Integer thearit;
0235   Handle(StepData_PDescr) thefrom;
0236   Standard_Boolean theopt;
0237   Standard_Boolean theder;
0238   TCollection_AsciiString thefnam;
0239   Standard_Integer thefnum;
0240 
0241 
0242 };
0243 
0244 
0245 
0246 
0247 
0248 
0249 
0250 #endif // _StepData_PDescr_HeaderFile