// File generated by CPPExt (Value)
//
//                     Copyright (C) 1991 - 2000 by  
//                      Matra Datavision SA.  All rights reserved.
//  
//                     Copyright (C) 2001 - 2004 by
//                     Open CASCADE SA.  All rights reserved.
// 
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//  
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.

#ifndef _StepData_EnumTool_HeaderFile
#define _StepData_EnumTool_HeaderFile

#ifndef _TColStd_SequenceOfAsciiString_HeaderFile
#include <TColStd_SequenceOfAsciiString.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Standard_CString_HeaderFile
#include <Standard_CString.hxx>
#endif
class TCollection_AsciiString;


#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif

//! This class gives a way of conversion between the value of an <br>
//!           enumeration and its representation in STEP <br>
//!           An enumeration corresponds to an integer with reserved values, <br>
//!           which begin to 0 <br>
//!           In STEP, it is represented by a name in capital letter and <br>
//!           limited by two dots, e.g. .UNKNOWN. <br>
//! <br>
//!           EnumTool works with integers, it is just required to cast <br>
//!           between an integer and an enumeration of required type. <br>
//! <br>
//!           Its definition is intended to allow static creation in once, <br>
//!           without having to recreate once for each use. <br>
//! <br>
//!           It is possible to define subclasses on it, which directly give <br>
//!           the good list of definition texts, and accepts a enumeration <br>
//!           of the good type instead of an integer <br>
class StepData_EnumTool  {

public:

    void* operator new(size_t,void* anAddress) 
      {
        return anAddress;
      }
    void* operator new(size_t size) 
      { 
        return Standard::Allocate(size); 
      }
    void  operator delete(void *anAddress) 
      { 
        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
      }
 // Methods PUBLIC
 // 

//! Creates an EnumTool with definitions given by e0 .. e<max> <br>
//!           Each definition string can bring one term, or several <br>
//!           separated by blanks. Each term corresponds to one value of the <br>
//!           enumeration, if dots are not presents they are added <br>
//! <br>
//!           Such a static constructor allows to build a static description <br>
//!            as : static StepData_EnumTool myenumtool("e0","e1"...); <br>
//!            then use it without having to initialise it <br>
//! <br>
//!           A null definition can be input by given "$" :the corresponding <br>
//!           position is attached to "null/undefined" value (as one <br>
//!           particular item of the enumeration list) <br>
Standard_EXPORT StepData_EnumTool(const Standard_CString e0 = "",const Standard_CString e1 = "",const Standard_CString e2 = "",const Standard_CString e3 = "",const Standard_CString e4 = "",const Standard_CString e5 = "",const Standard_CString e6 = "",const Standard_CString e7 = "",const Standard_CString e8 = "",const Standard_CString e9 = "",const Standard_CString e10 = "",const Standard_CString e11 = "",const Standard_CString e12 = "",const Standard_CString e13 = "",const Standard_CString e14 = "",const Standard_CString e15 = "",const Standard_CString e16 = "",const Standard_CString e17 = "",const Standard_CString e18 = "",const Standard_CString e19 = "",const Standard_CString e20 = "",const Standard_CString e21 = "",const Standard_CString e22 = "",const Standard_CString e23 = "",const Standard_CString e24 = "",const Standard_CString e25 = "",const Standard_CString e26 = "",const Standard_CString e27 = "",const Standard_CString e28 = "",const Standard_CString e29 = "",const Standard_CString e30 = "",const Standard_CString e31 = "",const Standard_CString e32 = "",const Standard_CString e33 = "",const Standard_CString e34 = "",const Standard_CString e35 = "",const Standard_CString e36 = "",const Standard_CString e37 = "",const Standard_CString e38 = "",const Standard_CString e39 = "");

//! Processes a definition, splits it according blanks if any <br>
//!           empty definitions are ignored <br>
//!           A null definition can be input by given "$" :the corresponding <br>
//!           position is attached to "null/undefined" value (as one <br>
//!           particular item of the enumeration list) <br>
//!           See also IsSet <br>
Standard_EXPORT   void AddDefinition(const Standard_CString term) ;

//! Returns True if at least one definition has been entered after <br>
//!           creation time (i.e. by AddDefinition only) <br>
//! <br>
//!           This allows to build a static description by a first pass : <br>
//!           static StepData_EnumTool myenumtool("e0" ...); <br>
//!           ... <br>
//!           if (!myenumtool.IsSet()) {             for further inits <br>
//!             myenumtool.AddDefinition("e21"); <br>
//!             ... <br>
//!           } <br>
Standard_EXPORT   Standard_Boolean IsSet() const;

//! Returns the maximum integer for a suitable value <br>
//!           Remark : while values begin at zero, MaxValue is the count of <br>
//!           recorded values minus one <br>
Standard_EXPORT   Standard_Integer MaxValue() const;

//! Sets or Unsets the EnumTool to accept undefined value (for <br>
//!           optional field). Ignored if no null value is defined (by "$") <br>
//!           Can be changed during execution (to read each field), <br>
//!           Default is True (if a null value is defined) <br>
Standard_EXPORT   void Optional(const Standard_Boolean mode) ;

//! Returns the value attached to "null/undefined value" <br>
//!           If none is specified or if Optional has been set to False, <br>
//!             returns -1 <br>
//!           Null Value has been specified by definition "$" <br>
Standard_EXPORT   Standard_Integer NullValue() const;

//! Returns the text which corresponds to a given numeric value <br>
//!           It is limited by dots <br>
//!           If num is out of range, returns an empty string <br>
Standard_EXPORT  const TCollection_AsciiString& Text(const Standard_Integer num) const;

//! Returns the numeric value found for a text <br>
//!           The text must be in capitals and limited by dots <br>
//!           A non-suitable text gives a negative value to be returned <br>
Standard_EXPORT   Standard_Integer Value(const Standard_CString txt) const;

//! Same as above but works on an AsciiString <br>
Standard_EXPORT   Standard_Integer Value(const TCollection_AsciiString& txt) const;





protected:

 // Methods PROTECTED
 // 


 // Fields PROTECTED
 //


private: 

 // Methods PRIVATE
 // 


 // Fields PRIVATE
 //
TColStd_SequenceOfAsciiString thetexts;
Standard_Integer theinit;
Standard_Boolean theopt;


};





// other Inline functions and methods (like "C++: function call" methods)
//


#endif
