]> OCCT Git - occt.git/commitdiff
Coding - Add conversion utilities for STEP geometrical and visual enumerations (...
authorPasukhin Dmitry <dpasukhi@opencascade.com>
Wed, 25 Jun 2025 10:40:51 +0000 (11:40 +0100)
committerGitHub <noreply@github.com>
Wed, 25 Jun 2025 10:40:51 +0000 (11:40 +0100)
- Introduced RWStepGeom_RWTransitionCode for converting StepGeom_TransitionCode to/from string representations.
- Refactored RWStepGeom_RWTrimmedCurve to utilize RWStepGeom_RWTrimmingPreference for trimming preference conversions.
- Created RWStepGeom_RWTrimmingPreference for handling StepGeom_TrimmingPreference enumerations.
- Updated RWStepGeom_RWUniformCurve and related classes to use RWStepGeom_RWBSplineCurveForm for B-spline curve form conversions.
- Added RWStepGeom_RWUniformSurface and related classes to use RWStepGeom_RWBSplineSurfaceForm for B-spline surface form conversions.
- Implemented RWStepShape_RWBooleanOperator for boolean operator conversions in STEP shapes.
- Refactored RWStepShape_RWBooleanResult to utilize RWStepShape_RWBooleanOperator for boolean operator handling.
- Introduced RWStepVisual_RWCentralOrParallel for central or parallel projection type conversions.
- Added RWStepVisual_RWSurfaceSide for surface side enumeration conversions.
- Updated RWStepVisual_RWSurfaceStyleUsage to use RWStepVisual_RWSurfaceSide for handling surface side.
- Created RWStepVisual_RWTextPath for text path enumeration conversions.
- Refactored RWStepVisual_RWTextLiteral to utilize RWStepVisual_RWTextPath for text path handling.
- Updated RWStepVisual_RWViewVolume to use RWStepVisual_RWCentralOrParallel for projection type conversions.

63 files changed:
src/DataExchange/TKDESTEP/RWStepBasic/FILES.cmake
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWAheadOrBehind.pxx [new file with mode: 0644]
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWCoordinatedUniversalTimeOffset.cxx
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWProductDefinitionFormationWithSpecifiedSource.cxx
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiPrefix.pxx [new file with mode: 0644]
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiUnit.cxx
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiUnit.pxx
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiUnitAndAreaUnit.cxx
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiUnitAndLengthUnit.cxx
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiUnitAndMassUnit.cxx
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiUnitAndPlaneAngleUnit.cxx
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiUnitAndRatioUnit.cxx
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiUnitAndSolidAngleUnit.cxx
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiUnitAndThermodynamicTemperatureUnit.cxx
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiUnitAndTimeUnit.cxx
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiUnitAndVolumeUnit.cxx
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiUnitName.pxx [new file with mode: 0644]
src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSource.pxx [new file with mode: 0644]
src/DataExchange/TKDESTEP/RWStepGeom/FILES.cmake
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWBSplineCurve.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWBSplineCurveForm.pxx [new file with mode: 0644]
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWBSplineCurveWithKnots.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWBSplineSurface.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWBSplineSurfaceForm.pxx [new file with mode: 0644]
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWBSplineSurfaceWithKnots.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWBezierCurve.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWBezierCurveAndRationalBSplineCurve.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWBezierSurface.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWBezierSurfaceAndRationalBSplineSurface.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWCompositeCurveSegment.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWIntersectionCurve.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWKnotType.pxx [new file with mode: 0644]
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWPreferredSurfaceCurveRepresentation.pxx [new file with mode: 0644]
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWQuasiUniformCurve.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWQuasiUniformCurveAndRationalBSplineCurve.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWQuasiUniformSurface.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWQuasiUniformSurfaceAndRationalBSplineSurface.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWRationalBSplineCurve.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWRationalBSplineSurface.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWReparametrisedCompositeCurveSegment.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWSeamCurve.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWSurfaceCurve.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWSurfaceCurveAndBoundedCurve.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWSurfacePatch.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWTransitionCode.pxx [new file with mode: 0644]
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWTrimmedCurve.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWTrimmingPreference.pxx [new file with mode: 0644]
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWUniformCurve.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWUniformCurveAndRationalBSplineCurve.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWUniformSurface.cxx
src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWUniformSurfaceAndRationalBSplineSurface.cxx
src/DataExchange/TKDESTEP/RWStepShape/FILES.cmake
src/DataExchange/TKDESTEP/RWStepShape/RWStepShape_RWBooleanOperator.pxx [new file with mode: 0644]
src/DataExchange/TKDESTEP/RWStepShape/RWStepShape_RWBooleanResult.cxx
src/DataExchange/TKDESTEP/RWStepVisual/FILES.cmake
src/DataExchange/TKDESTEP/RWStepVisual/RWStepVisual_RWCentralOrParallel.pxx [new file with mode: 0644]
src/DataExchange/TKDESTEP/RWStepVisual/RWStepVisual_RWSurfaceSide.pxx [new file with mode: 0644]
src/DataExchange/TKDESTEP/RWStepVisual/RWStepVisual_RWSurfaceStyleUsage.cxx
src/DataExchange/TKDESTEP/RWStepVisual/RWStepVisual_RWTextLiteral.cxx
src/DataExchange/TKDESTEP/RWStepVisual/RWStepVisual_RWTextPath.pxx [new file with mode: 0644]
src/DataExchange/TKDESTEP/RWStepVisual/RWStepVisual_RWViewVolume.cxx

index fe5e4674d0ac70032b0681f26bc298509f8ba287..8d28be9660f2d1f9990f20dc87bf4b502c58ec62 100644 (file)
@@ -14,6 +14,7 @@ set(OCCT_RWStepBasic_FILES
   RWStepBasic_RWActionRequestSolution.pxx
   RWStepBasic_RWAddress.cxx
   RWStepBasic_RWAddress.pxx
+  RWStepBasic_RWAheadOrBehind.pxx
   RWStepBasic_RWApplicationContext.cxx
   RWStepBasic_RWApplicationContext.pxx
   RWStepBasic_RWApplicationContextElement.cxx
@@ -208,6 +209,7 @@ set(OCCT_RWStepBasic_FILES
   RWStepBasic_RWSecurityClassification.pxx
   RWStepBasic_RWSecurityClassificationLevel.cxx
   RWStepBasic_RWSecurityClassificationLevel.pxx
+  RWStepBasic_RWSiPrefix.pxx
   RWStepBasic_RWSiUnit.cxx
   RWStepBasic_RWSiUnit.pxx
   RWStepBasic_RWSiUnitAndAreaUnit.cxx
@@ -228,10 +230,12 @@ set(OCCT_RWStepBasic_FILES
   RWStepBasic_RWSiUnitAndTimeUnit.pxx
   RWStepBasic_RWSiUnitAndVolumeUnit.cxx
   RWStepBasic_RWSiUnitAndVolumeUnit.pxx
+  RWStepBasic_RWSiUnitName.pxx
   RWStepBasic_RWSolidAngleMeasureWithUnit.cxx
   RWStepBasic_RWSolidAngleMeasureWithUnit.pxx
   RWStepBasic_RWSolidAngleUnit.cxx
   RWStepBasic_RWSolidAngleUnit.pxx
+  RWStepBasic_RWSource.pxx
   RWStepBasic_RWThermodynamicTemperatureUnit.cxx
   RWStepBasic_RWThermodynamicTemperatureUnit.pxx
   RWStepBasic_RWUncertaintyMeasureWithUnit.cxx
diff --git a/src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWAheadOrBehind.pxx b/src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWAheadOrBehind.pxx
new file mode 100644 (file)
index 0000000..60c3860
--- /dev/null
@@ -0,0 +1,71 @@
+// Copyright (c) 2025 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 _RWStepBasic_RWAheadOrBehind_HeaderFile
+#define _RWStepBasic_RWAheadOrBehind_HeaderFile
+
+#include <StepBasic_AheadOrBehind.hxx>
+#include <Standard_CString.hxx>
+
+namespace RWStepBasic_RWAheadOrBehind
+{
+static constexpr char aobAhead[]  = ".AHEAD.";
+static constexpr char aobExact[]  = ".EXACT.";
+static constexpr char aobBehind[] = ".BEHIND.";
+
+//! Convert StepBasic_AheadOrBehind to string
+//! @param theSourceEnum The StepBasic_AheadOrBehind value to convert
+//! @return The corresponding string representation or nullptr if not found
+inline const char* ConvertToString(const StepBasic_AheadOrBehind theSourceEnum)
+{
+  switch (theSourceEnum)
+  {
+    case StepBasic_aobAhead:
+      return aobAhead;
+    case StepBasic_aobExact:
+      return aobExact;
+    case StepBasic_aobBehind:
+      return aobBehind;
+  }
+  return nullptr;
+}
+
+//! Convert string to StepBasic_AheadOrBehind
+//! @param theAheadOrBehindStr The string to convert
+//! @param theResultEnum The corresponding StepBasic_AheadOrBehind value
+//! @return Standard_True if the conversion was successful, Standard_False otherwise
+inline bool ConvertToEnum(const Standard_CString   theAheadOrBehindStr,
+                          StepBasic_AheadOrBehind& theResultEnum)
+{
+  if (IsEqual(theAheadOrBehindStr, aobAhead))
+  {
+    theResultEnum = StepBasic_aobAhead;
+  }
+  else if (IsEqual(theAheadOrBehindStr, aobExact))
+  {
+    theResultEnum = StepBasic_aobExact;
+  }
+  else if (IsEqual(theAheadOrBehindStr, aobBehind))
+  {
+    theResultEnum = StepBasic_aobBehind;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+
+} // namespace RWStepBasic_RWAheadOrBehind
+
+#endif // _RWStepBasic_RWAheadOrBehind_HeaderFile
index f77e91f4baabc52e7aaf5b3120efefa9e0334466..9c6025c8ad32e31e575ca05373a71b33877fd686 100644 (file)
 #include <StepData_StepWriter.hxx>
 #include <TCollection_AsciiString.hxx>
 
-// --- Enum : AheadOrBehind ---
-static TCollection_AsciiString aobAhead(".AHEAD.");
-static TCollection_AsciiString aobExact(".EXACT.");
-static TCollection_AsciiString aobBehind(".BEHIND.");
+#include "RWStepBasic_RWAheadOrBehind.pxx"
 
 RWStepBasic_RWCoordinatedUniversalTimeOffset::RWStepBasic_RWCoordinatedUniversalTimeOffset() {}
 
@@ -63,14 +60,10 @@ void RWStepBasic_RWCoordinatedUniversalTimeOffset::ReadStep(
   if (data->ParamType(num, 3) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 3);
-    if (aobAhead.IsEqual(text))
-      aSense = StepBasic_aobAhead;
-    else if (aobExact.IsEqual(text))
-      aSense = StepBasic_aobExact;
-    else if (aobBehind.IsEqual(text))
-      aSense = StepBasic_aobBehind;
-    else
+    if (!RWStepBasic_RWAheadOrBehind::ConvertToEnum(text, aSense))
+    {
       ach->AddFail("Enumeration ahead_or_behind has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #3 (sense) is not an enumeration");
@@ -103,16 +96,5 @@ void RWStepBasic_RWCoordinatedUniversalTimeOffset::WriteStep(
 
   // --- own field : sense ---
 
-  switch (ent->Sense())
-  {
-    case StepBasic_aobAhead:
-      SW.SendEnum(aobAhead);
-      break;
-    case StepBasic_aobExact:
-      SW.SendEnum(aobExact);
-      break;
-    case StepBasic_aobBehind:
-      SW.SendEnum(aobBehind);
-      break;
-  }
+  SW.SendEnum(RWStepBasic_RWAheadOrBehind::ConvertToString(ent->Sense()));
 }
index 0d297cd95dee5d50070feea3de16a43f1ccda0ed..37d8a8679ee5babcd106b5908dd4a61855120338 100644 (file)
 #include <StepData_StepWriter.hxx>
 #include <TCollection_AsciiString.hxx>
 
-// --- Enum : Source ---
-static TCollection_AsciiString sBought(".BOUGHT.");
-static TCollection_AsciiString sNotKnown(".NOT_KNOWN.");
-static TCollection_AsciiString sMade(".MADE.");
+#include "RWStepBasic_RWSource.pxx"
 
 RWStepBasic_RWProductDefinitionFormationWithSpecifiedSource::
   RWStepBasic_RWProductDefinitionFormationWithSpecifiedSource()
@@ -66,14 +63,10 @@ void RWStepBasic_RWProductDefinitionFormationWithSpecifiedSource::ReadStep(
   if (data->ParamType(num, 4) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 4);
-    if (sBought.IsEqual(text))
-      aMakeOrBuy = StepBasic_sBought;
-    else if (sNotKnown.IsEqual(text))
-      aMakeOrBuy = StepBasic_sNotKnown;
-    else if (sMade.IsEqual(text))
-      aMakeOrBuy = StepBasic_sMade;
-    else
+    if (!RWStepBasic_RWSource::ConvertToEnum(text, aMakeOrBuy))
+    {
       ach->AddFail("Enumeration source has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #4 (make_or_buy) is not an enumeration");
@@ -102,18 +95,7 @@ void RWStepBasic_RWProductDefinitionFormationWithSpecifiedSource::WriteStep(
 
   // --- own field : makeOrBuy ---
 
-  switch (ent->MakeOrBuy())
-  {
-    case StepBasic_sBought:
-      SW.SendEnum(sBought);
-      break;
-    case StepBasic_sNotKnown:
-      SW.SendEnum(sNotKnown);
-      break;
-    case StepBasic_sMade:
-      SW.SendEnum(sMade);
-      break;
-  }
+  SW.SendEnum(RWStepBasic_RWSource::ConvertToString(ent->MakeOrBuy()));
 }
 
 void RWStepBasic_RWProductDefinitionFormationWithSpecifiedSource::Share(
diff --git a/src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiPrefix.pxx b/src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiPrefix.pxx
new file mode 100644 (file)
index 0000000..59ab2c9
--- /dev/null
@@ -0,0 +1,161 @@
+// Copyright (c) 2025 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 _RWStepBasic_RWSiPrefix_HeaderFile
+#define _RWStepBasic_RWSiPrefix_HeaderFile
+
+#include <StepBasic_SiPrefix.hxx>
+#include <Standard_CString.hxx>
+
+namespace RWStepBasic_RWSiPrefix
+{
+static constexpr char spExa[]   = ".EXA.";
+static constexpr char spPico[]  = ".PICO.";
+static constexpr char spMega[]  = ".MEGA.";
+static constexpr char spFemto[] = ".FEMTO.";
+static constexpr char spAtto[]  = ".ATTO.";
+static constexpr char spCenti[] = ".CENTI.";
+static constexpr char spNano[]  = ".NANO.";
+static constexpr char spHecto[] = ".HECTO.";
+static constexpr char spMicro[] = ".MICRO.";
+static constexpr char spTera[]  = ".TERA.";
+static constexpr char spGiga[]  = ".GIGA.";
+static constexpr char spMilli[] = ".MILLI.";
+static constexpr char spPeta[]  = ".PETA.";
+static constexpr char spDeci[]  = ".DECI.";
+static constexpr char spKilo[]  = ".KILO.";
+static constexpr char spDeca[]  = ".DECA.";
+
+//! Convert StepBasic_SiPrefix to string
+//! @param theSourceEnum The StepBasic_SiPrefix value to convert
+//! @return The corresponding string representation or nullptr if not found
+inline const char* ConvertToString(const StepBasic_SiPrefix theSourceEnum)
+{
+  switch (theSourceEnum)
+  {
+    case StepBasic_spExa:
+      return spExa;
+    case StepBasic_spPico:
+      return spPico;
+    case StepBasic_spMega:
+      return spMega;
+    case StepBasic_spFemto:
+      return spFemto;
+    case StepBasic_spAtto:
+      return spAtto;
+    case StepBasic_spCenti:
+      return spCenti;
+    case StepBasic_spNano:
+      return spNano;
+    case StepBasic_spHecto:
+      return spHecto;
+    case StepBasic_spMicro:
+      return spMicro;
+    case StepBasic_spTera:
+      return spTera;
+    case StepBasic_spGiga:
+      return spGiga;
+    case StepBasic_spMilli:
+      return spMilli;
+    case StepBasic_spPeta:
+      return spPeta;
+    case StepBasic_spDeci:
+      return spDeci;
+    case StepBasic_spKilo:
+      return spKilo;
+    case StepBasic_spDeca:
+      return spDeca;
+  }
+  return nullptr; // Default value
+}
+
+//! Convert string to StepBasic_SiPrefix
+//! @param thePrefixStr The string to convert
+//! @param theResultEnum The corresponding StepBasic_SiPrefix value
+//! @return Standard_True if the conversion was successful, Standard_False otherwise
+inline bool ConvertToEnum(const Standard_CString thePrefixStr, StepBasic_SiPrefix& theResultEnum)
+{
+  if (IsEqual(thePrefixStr, spExa))
+  {
+    theResultEnum = StepBasic_spExa;
+  }
+  else if (IsEqual(thePrefixStr, spPico))
+  {
+    theResultEnum = StepBasic_spPico;
+  }
+  else if (IsEqual(thePrefixStr, spMega))
+  {
+    theResultEnum = StepBasic_spMega;
+  }
+  else if (IsEqual(thePrefixStr, spFemto))
+  {
+    theResultEnum = StepBasic_spFemto;
+  }
+  else if (IsEqual(thePrefixStr, spAtto))
+  {
+    theResultEnum = StepBasic_spAtto;
+  }
+  else if (IsEqual(thePrefixStr, spCenti))
+  {
+    theResultEnum = StepBasic_spCenti;
+  }
+  else if (IsEqual(thePrefixStr, spNano))
+  {
+    theResultEnum = StepBasic_spNano;
+  }
+  else if (IsEqual(thePrefixStr, spHecto))
+  {
+    theResultEnum = StepBasic_spHecto;
+  }
+  else if (IsEqual(thePrefixStr, spMicro))
+  {
+    theResultEnum = StepBasic_spMicro;
+  }
+  else if (IsEqual(thePrefixStr, spTera))
+  {
+    theResultEnum = StepBasic_spTera;
+  }
+  else if (IsEqual(thePrefixStr, spGiga))
+  {
+    theResultEnum = StepBasic_spGiga;
+  }
+  else if (IsEqual(thePrefixStr, spMilli))
+  {
+    theResultEnum = StepBasic_spMilli;
+  }
+  else if (IsEqual(thePrefixStr, spPeta))
+  {
+    theResultEnum = StepBasic_spPeta;
+  }
+  else if (IsEqual(thePrefixStr, spDeci))
+  {
+    theResultEnum = StepBasic_spDeci;
+  }
+  else if (IsEqual(thePrefixStr, spKilo))
+  {
+    theResultEnum = StepBasic_spKilo;
+  }
+  else if (IsEqual(thePrefixStr, spDeca))
+  {
+    theResultEnum = StepBasic_spDeca;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+
+} // namespace RWStepBasic_RWSiPrefix
+
+#endif // _RWStepBasic_RWSiPrefix_HeaderFile
index c00fee985b6a6c3e1b585f0391e1195d25cd693d..48a642ead3a6feb4197bfbfd47ecc657ab7a4314 100644 (file)
 #include <StepData_StepWriter.hxx>
 #include <TCollection_AsciiString.hxx>
 
-// --- Enum : SiPrefix ---
-static TCollection_AsciiString spExa(".EXA.");
-static TCollection_AsciiString spPico(".PICO.");
-static TCollection_AsciiString spMega(".MEGA.");
-static TCollection_AsciiString spFemto(".FEMTO.");
-static TCollection_AsciiString spAtto(".ATTO.");
-static TCollection_AsciiString spCenti(".CENTI.");
-static TCollection_AsciiString spNano(".NANO.");
-static TCollection_AsciiString spHecto(".HECTO.");
-static TCollection_AsciiString spMicro(".MICRO.");
-static TCollection_AsciiString spTera(".TERA.");
-static TCollection_AsciiString spGiga(".GIGA.");
-static TCollection_AsciiString spMilli(".MILLI.");
-static TCollection_AsciiString spPeta(".PETA.");
-static TCollection_AsciiString spDeci(".DECI.");
-static TCollection_AsciiString spKilo(".KILO.");
-static TCollection_AsciiString spDeca(".DECA.");
-
-// --- Enum : SiUnitName ---
-static TCollection_AsciiString sunHertz(".HERTZ.");
-static TCollection_AsciiString sunDegreeCelsius(".DEGREE_CELSIUS.");
-static TCollection_AsciiString sunSiemens(".SIEMENS.");
-static TCollection_AsciiString sunSievert(".SIEVERT.");
-static TCollection_AsciiString sunLux(".LUX.");
-static TCollection_AsciiString sunWatt(".WATT.");
-static TCollection_AsciiString sunOhm(".OHM.");
-static TCollection_AsciiString sunSecond(".SECOND.");
-static TCollection_AsciiString sunBecquerel(".BECQUEREL.");
-static TCollection_AsciiString sunPascal(".PASCAL.");
-static TCollection_AsciiString sunHenry(".HENRY.");
-static TCollection_AsciiString sunTesla(".TESLA.");
-static TCollection_AsciiString sunVolt(".VOLT.");
-static TCollection_AsciiString sunJoule(".JOULE.");
-static TCollection_AsciiString sunKelvin(".KELVIN.");
-static TCollection_AsciiString sunAmpere(".AMPERE.");
-static TCollection_AsciiString sunGram(".GRAM.");
-static TCollection_AsciiString sunSteradian(".STERADIAN.");
-static TCollection_AsciiString sunMole(".MOLE.");
-static TCollection_AsciiString sunLumen(".LUMEN.");
-static TCollection_AsciiString sunGray(".GRAY.");
-static TCollection_AsciiString sunCandela(".CANDELA.");
-static TCollection_AsciiString sunFarad(".FARAD.");
-static TCollection_AsciiString sunRadian(".RADIAN.");
-static TCollection_AsciiString sunNewton(".NEWTON.");
-static TCollection_AsciiString sunMetre(".METRE.");
-static TCollection_AsciiString sunWeber(".WEBER.");
-static TCollection_AsciiString sunCoulomb(".COULOMB.");
+#include "RWStepBasic_RWSiPrefix.pxx"
+#include "RWStepBasic_RWSiUnitName.pxx"
 
 RWStepBasic_RWSiUnit::RWStepBasic_RWSiUnit() {}
 
@@ -90,12 +45,16 @@ void RWStepBasic_RWSiUnit::ReadStep(const Handle(StepData_StepReaderData)& data,
     if (data->ParamType(num, 2) == Interface_ParamEnum)
     {
       Standard_CString text = data->ParamCValue(num, 2);
-      hasAprefix            = DecodePrefix(aPrefix, text);
+      hasAprefix            = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
       if (!hasAprefix)
+      {
         ach->AddFail("Enumeration si_prefix has not an allowed value");
+      }
     }
     else
+    {
       ach->AddFail("Parameter #2 (prefix) is not an enumeration");
+    }
   }
 
   // --- own field : name ---
@@ -103,8 +62,10 @@ void RWStepBasic_RWSiUnit::ReadStep(const Handle(StepData_StepReaderData)& data,
   if (data->ParamType(num, 3) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 3);
-    if (!DecodeName(aName, text))
+    if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
+    {
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #3 (name) is not an enumeration");
@@ -123,218 +84,10 @@ void RWStepBasic_RWSiUnit::WriteStep(StepData_StepWriter&            SW,
   // --- own field : prefix ---
   Standard_Boolean hasAprefix = ent->HasPrefix();
   if (hasAprefix)
-    SW.SendEnum(EncodePrefix(ent->Prefix()));
+    SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
   else
     SW.SendUndef();
 
   // --- own field : name ---
-  SW.SendEnum(EncodeName(ent->Name()));
-}
-
-Standard_Boolean RWStepBasic_RWSiUnit::DecodePrefix(StepBasic_SiPrefix&    aPrefix,
-                                                    const Standard_CString text) const
-{
-  if (spExa.IsEqual(text))
-    aPrefix = StepBasic_spExa;
-  else if (spPico.IsEqual(text))
-    aPrefix = StepBasic_spPico;
-  else if (spMega.IsEqual(text))
-    aPrefix = StepBasic_spMega;
-  else if (spFemto.IsEqual(text))
-    aPrefix = StepBasic_spFemto;
-  else if (spAtto.IsEqual(text))
-    aPrefix = StepBasic_spAtto;
-  else if (spCenti.IsEqual(text))
-    aPrefix = StepBasic_spCenti;
-  else if (spNano.IsEqual(text))
-    aPrefix = StepBasic_spNano;
-  else if (spHecto.IsEqual(text))
-    aPrefix = StepBasic_spHecto;
-  else if (spMicro.IsEqual(text))
-    aPrefix = StepBasic_spMicro;
-  else if (spTera.IsEqual(text))
-    aPrefix = StepBasic_spTera;
-  else if (spGiga.IsEqual(text))
-    aPrefix = StepBasic_spGiga;
-  else if (spMilli.IsEqual(text))
-    aPrefix = StepBasic_spMilli;
-  else if (spPeta.IsEqual(text))
-    aPrefix = StepBasic_spPeta;
-  else if (spDeci.IsEqual(text))
-    aPrefix = StepBasic_spDeci;
-  else if (spKilo.IsEqual(text))
-    aPrefix = StepBasic_spKilo;
-  else if (spDeca.IsEqual(text))
-    aPrefix = StepBasic_spDeca;
-  else
-    return Standard_False;
-  return Standard_True;
-}
-
-Standard_Boolean RWStepBasic_RWSiUnit::DecodeName(StepBasic_SiUnitName&  aName,
-                                                  const Standard_CString text) const
-{
-  if (sunHertz.IsEqual(text))
-    aName = StepBasic_sunHertz;
-  else if (sunDegreeCelsius.IsEqual(text))
-    aName = StepBasic_sunDegreeCelsius;
-  else if (sunSiemens.IsEqual(text))
-    aName = StepBasic_sunSiemens;
-  else if (sunSievert.IsEqual(text))
-    aName = StepBasic_sunSievert;
-  else if (sunLux.IsEqual(text))
-    aName = StepBasic_sunLux;
-  else if (sunWatt.IsEqual(text))
-    aName = StepBasic_sunWatt;
-  else if (sunOhm.IsEqual(text))
-    aName = StepBasic_sunOhm;
-  else if (sunSecond.IsEqual(text))
-    aName = StepBasic_sunSecond;
-  else if (sunBecquerel.IsEqual(text))
-    aName = StepBasic_sunBecquerel;
-  else if (sunPascal.IsEqual(text))
-    aName = StepBasic_sunPascal;
-  else if (sunHenry.IsEqual(text))
-    aName = StepBasic_sunHenry;
-  else if (sunTesla.IsEqual(text))
-    aName = StepBasic_sunTesla;
-  else if (sunVolt.IsEqual(text))
-    aName = StepBasic_sunVolt;
-  else if (sunJoule.IsEqual(text))
-    aName = StepBasic_sunJoule;
-  else if (sunKelvin.IsEqual(text))
-    aName = StepBasic_sunKelvin;
-  else if (sunAmpere.IsEqual(text))
-    aName = StepBasic_sunAmpere;
-  else if (sunGram.IsEqual(text))
-    aName = StepBasic_sunGram;
-  else if (sunSteradian.IsEqual(text))
-    aName = StepBasic_sunSteradian;
-  else if (sunMole.IsEqual(text))
-    aName = StepBasic_sunMole;
-  else if (sunLumen.IsEqual(text))
-    aName = StepBasic_sunLumen;
-  else if (sunGray.IsEqual(text))
-    aName = StepBasic_sunGray;
-  else if (sunCandela.IsEqual(text))
-    aName = StepBasic_sunCandela;
-  else if (sunFarad.IsEqual(text))
-    aName = StepBasic_sunFarad;
-  else if (sunRadian.IsEqual(text))
-    aName = StepBasic_sunRadian;
-  else if (sunNewton.IsEqual(text))
-    aName = StepBasic_sunNewton;
-  else if (sunMetre.IsEqual(text))
-    aName = StepBasic_sunMetre;
-  else if (sunWeber.IsEqual(text))
-    aName = StepBasic_sunWeber;
-  else if (sunCoulomb.IsEqual(text))
-    aName = StepBasic_sunCoulomb;
-  else
-    return Standard_False;
-  return Standard_True;
-}
-
-TCollection_AsciiString RWStepBasic_RWSiUnit::EncodePrefix(const StepBasic_SiPrefix aPrefix) const
-{
-  switch (aPrefix)
-  {
-    case StepBasic_spExa:
-      return spExa;
-    case StepBasic_spPico:
-      return spPico;
-    case StepBasic_spMega:
-      return spMega;
-    case StepBasic_spFemto:
-      return spFemto;
-    case StepBasic_spAtto:
-      return spAtto;
-    case StepBasic_spCenti:
-      return spCenti;
-    case StepBasic_spNano:
-      return spNano;
-    case StepBasic_spHecto:
-      return spHecto;
-    case StepBasic_spMicro:
-      return spMicro;
-    case StepBasic_spTera:
-      return spTera;
-    case StepBasic_spGiga:
-      return spGiga;
-    case StepBasic_spMilli:
-      return spMilli;
-    case StepBasic_spPeta:
-      return spPeta;
-    case StepBasic_spDeci:
-      return spDeci;
-    case StepBasic_spKilo:
-      return spKilo;
-    case StepBasic_spDeca:
-      return spDeca;
-  }
-  return TCollection_AsciiString("");
-}
-
-TCollection_AsciiString RWStepBasic_RWSiUnit::EncodeName(const StepBasic_SiUnitName aName) const
-{
-  switch (aName)
-  {
-    case StepBasic_sunHertz:
-      return sunHertz;
-    case StepBasic_sunDegreeCelsius:
-      return sunDegreeCelsius;
-    case StepBasic_sunSiemens:
-      return sunSiemens;
-    case StepBasic_sunSievert:
-      return sunSievert;
-    case StepBasic_sunLux:
-      return sunLux;
-    case StepBasic_sunWatt:
-      return sunWatt;
-    case StepBasic_sunOhm:
-      return sunOhm;
-    case StepBasic_sunSecond:
-      return sunSecond;
-    case StepBasic_sunBecquerel:
-      return sunBecquerel;
-    case StepBasic_sunPascal:
-      return sunPascal;
-    case StepBasic_sunHenry:
-      return sunHenry;
-    case StepBasic_sunTesla:
-      return sunTesla;
-    case StepBasic_sunVolt:
-      return sunVolt;
-    case StepBasic_sunJoule:
-      return sunJoule;
-    case StepBasic_sunKelvin:
-      return sunKelvin;
-    case StepBasic_sunAmpere:
-      return sunAmpere;
-    case StepBasic_sunGram:
-      return sunGram;
-    case StepBasic_sunSteradian:
-      return sunSteradian;
-    case StepBasic_sunMole:
-      return sunMole;
-    case StepBasic_sunLumen:
-      return sunLumen;
-    case StepBasic_sunGray:
-      return sunGray;
-    case StepBasic_sunCandela:
-      return sunCandela;
-    case StepBasic_sunFarad:
-      return sunFarad;
-    case StepBasic_sunRadian:
-      return sunRadian;
-    case StepBasic_sunNewton:
-      return sunNewton;
-    case StepBasic_sunMetre:
-      return sunMetre;
-    case StepBasic_sunWeber:
-      return sunWeber;
-    case StepBasic_sunCoulomb:
-      return sunCoulomb;
-  }
-  return TCollection_AsciiString("");
+  SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
 }
index 35ba69f5e26984950075c379b7d18b8b94545db8..8af83435ce2a334dd84a6ee51117c46187e92f14 100644 (file)
@@ -47,16 +47,6 @@ public:
   Standard_HIDDEN void WriteStep(StepData_StepWriter&            SW,
                                  const Handle(StepBasic_SiUnit)& ent) const;
 
-  Standard_HIDDEN Standard_Boolean DecodePrefix(StepBasic_SiPrefix&    aPrefix,
-                                                const Standard_CString text) const;
-
-  Standard_HIDDEN Standard_Boolean DecodeName(StepBasic_SiUnitName&  aName,
-                                              const Standard_CString text) const;
-
-  Standard_HIDDEN TCollection_AsciiString EncodePrefix(const StepBasic_SiPrefix aPrefix) const;
-
-  Standard_HIDDEN TCollection_AsciiString EncodeName(const StepBasic_SiUnitName aName) const;
-
 protected:
 private:
 };
index 52c7d050d3df698672a0e82c3859e4bb4cf89425..b994553351f9c2bbc8d9f72e49e37c81453d0519 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include "RWStepBasic_RWSiUnit.pxx"
 #include "RWStepBasic_RWSiUnitAndAreaUnit.pxx"
 #include <StepBasic_DimensionalExponents.hxx>
 #include <StepBasic_SiUnitAndAreaUnit.hxx>
 #include <StepData_StepReaderData.hxx>
 #include <StepData_StepWriter.hxx>
 
+#include "RWStepBasic_RWSiUnitName.pxx"
+#include "RWStepBasic_RWSiPrefix.pxx"
+
 RWStepBasic_RWSiUnitAndAreaUnit::RWStepBasic_RWSiUnitAndAreaUnit() {}
 
 void RWStepBasic_RWSiUnitAndAreaUnit::ReadStep(const Handle(StepData_StepReaderData)&     data,
@@ -48,15 +50,14 @@ void RWStepBasic_RWSiUnitAndAreaUnit::ReadStep(const Handle(StepData_StepReaderD
   if (!data->CheckNbParams(num, 2, ach, "si_unit"))
     return;
 
-  RWStepBasic_RWSiUnit reader;
-  StepBasic_SiPrefix   aPrefix    = StepBasic_spExa;
-  Standard_Boolean     hasAprefix = Standard_False;
+  StepBasic_SiPrefix aPrefix    = StepBasic_spExa;
+  Standard_Boolean   hasAprefix = Standard_False;
   if (data->IsParamDefined(num, 1))
   {
     if (data->ParamType(num, 1) == Interface_ParamEnum)
     {
       Standard_CString text = data->ParamCValue(num, 1);
-      hasAprefix            = reader.DecodePrefix(aPrefix, text);
+      hasAprefix            = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
       if (!hasAprefix)
       {
         ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -74,7 +75,7 @@ void RWStepBasic_RWSiUnitAndAreaUnit::ReadStep(const Handle(StepData_StepReaderD
   if (data->ParamType(num, 2) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 2);
-    if (!reader.DecodeName(aName, text))
+    if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
     {
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
       return;
@@ -99,12 +100,11 @@ void RWStepBasic_RWSiUnitAndAreaUnit::WriteStep(
   SW.Send(ent->Dimensions());
   SW.StartEntity("SI_UNIT");
 
-  RWStepBasic_RWSiUnit writer;
-  Standard_Boolean     hasAprefix = ent->HasPrefix();
+  Standard_Boolean hasAprefix = ent->HasPrefix();
   if (hasAprefix)
-    SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
+    SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
   else
     SW.SendUndef();
 
-  SW.SendEnum(writer.EncodeName(ent->Name()));
+  SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
 }
index b58d8a67b3612d61726ca4189fc7988cbf646662..b54be4319d89e99c9a0955f79f06a63f84624b72 100644 (file)
@@ -13,7 +13,6 @@
 
 // pdn 24.12.98 t3d_opt.stp: treatment of unsorted uncertanties
 
-#include "RWStepBasic_RWSiUnit.pxx"
 #include "RWStepBasic_RWSiUnitAndLengthUnit.pxx"
 #include <StepBasic_DimensionalExponents.hxx>
 #include <StepBasic_SiPrefix.hxx>
@@ -22,6 +21,9 @@
 #include <StepData_StepReaderData.hxx>
 #include <StepData_StepWriter.hxx>
 
+#include "RWStepBasic_RWSiUnitName.pxx"
+#include "RWStepBasic_RWSiPrefix.pxx"
+
 RWStepBasic_RWSiUnitAndLengthUnit::RWStepBasic_RWSiUnitAndLengthUnit() {}
 
 void RWStepBasic_RWSiUnitAndLengthUnit::ReadStep(
@@ -59,15 +61,14 @@ void RWStepBasic_RWSiUnitAndLengthUnit::ReadStep(
     return;
 
   // --- field : prefix ---
-  RWStepBasic_RWSiUnit reader;
-  StepBasic_SiPrefix   aPrefix    = StepBasic_spExa;
-  Standard_Boolean     hasAprefix = Standard_False;
+  StepBasic_SiPrefix aPrefix    = StepBasic_spExa;
+  Standard_Boolean   hasAprefix = Standard_False;
   if (data->IsParamDefined(num, 1))
   {
     if (data->ParamType(num, 1) == Interface_ParamEnum)
     {
       Standard_CString text = data->ParamCValue(num, 1);
-      hasAprefix            = reader.DecodePrefix(aPrefix, text);
+      hasAprefix            = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
       if (!hasAprefix)
       {
         ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -86,7 +87,7 @@ void RWStepBasic_RWSiUnitAndLengthUnit::ReadStep(
   if (data->ParamType(num, 2) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 2);
-    if (!reader.DecodeName(aName, text))
+    if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
     {
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
       return;
@@ -121,13 +122,12 @@ void RWStepBasic_RWSiUnitAndLengthUnit::WriteStep(
   SW.StartEntity("SI_UNIT");
 
   // --- field : prefix ---
-  RWStepBasic_RWSiUnit writer;
-  Standard_Boolean     hasAprefix = ent->HasPrefix();
+  Standard_Boolean hasAprefix = ent->HasPrefix();
   if (hasAprefix)
-    SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
+    SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
   else
     SW.SendUndef();
 
   // --- field : name ---
-  SW.SendEnum(writer.EncodeName(ent->Name()));
+  SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
 }
index ff80d7f30a787ed3ac4aa12df9431e33ae433bd1..dd43f6a72fbf0d9f795a118cfd8e42bb4aed38c4 100644 (file)
@@ -11,7 +11,6 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include "RWStepBasic_RWSiUnit.pxx"
 #include "RWStepBasic_RWSiUnitAndMassUnit.pxx"
 #include <StepBasic_DimensionalExponents.hxx>
 #include <StepBasic_SiPrefix.hxx>
@@ -20,6 +19,9 @@
 #include <StepData_StepReaderData.hxx>
 #include <StepData_StepWriter.hxx>
 
+#include "RWStepBasic_RWSiUnitName.pxx"
+#include "RWStepBasic_RWSiPrefix.pxx"
+
 //=================================================================================================
 
 RWStepBasic_RWSiUnitAndMassUnit::RWStepBasic_RWSiUnitAndMassUnit() {}
@@ -60,15 +62,14 @@ void RWStepBasic_RWSiUnitAndMassUnit::ReadStep(const Handle(StepData_StepReaderD
     return;
 
   // --- field : prefix ---
-  RWStepBasic_RWSiUnit reader;
-  StepBasic_SiPrefix   aPrefix    = StepBasic_spExa;
-  Standard_Boolean     hasAprefix = Standard_False;
+  StepBasic_SiPrefix aPrefix    = StepBasic_spExa;
+  Standard_Boolean   hasAprefix = Standard_False;
   if (data->IsParamDefined(num, 1))
   {
     if (data->ParamType(num, 1) == Interface_ParamEnum)
     {
       Standard_CString text = data->ParamCValue(num, 1);
-      hasAprefix            = reader.DecodePrefix(aPrefix, text);
+      hasAprefix            = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
       if (!hasAprefix)
       {
         ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -87,7 +88,7 @@ void RWStepBasic_RWSiUnitAndMassUnit::ReadStep(const Handle(StepData_StepReaderD
   if (data->ParamType(num, 2) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 2);
-    if (!reader.DecodeName(aName, text))
+    if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
     {
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
       return;
@@ -122,13 +123,12 @@ void RWStepBasic_RWSiUnitAndMassUnit::WriteStep(
   SW.StartEntity("SI_UNIT");
 
   // --- field : prefix ---
-  RWStepBasic_RWSiUnit writer;
-  Standard_Boolean     hasAprefix = ent->HasPrefix();
+  Standard_Boolean hasAprefix = ent->HasPrefix();
   if (hasAprefix)
-    SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
+    SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
   else
     SW.SendUndef();
 
   // --- field : name ---
-  SW.SendEnum(writer.EncodeName(ent->Name()));
+  SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
 }
index 89fd15e00c7574f99c6794b7f4070d35ddc4e239..f3f5e1f5e1ca13cd07a26972bef26f834f716d1f 100644 (file)
@@ -11,7 +11,6 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include "RWStepBasic_RWSiUnit.pxx"
 #include "RWStepBasic_RWSiUnitAndPlaneAngleUnit.pxx"
 #include <StepBasic_DimensionalExponents.hxx>
 #include <StepBasic_SiPrefix.hxx>
@@ -20,6 +19,9 @@
 #include <StepData_StepReaderData.hxx>
 #include <StepData_StepWriter.hxx>
 
+#include "RWStepBasic_RWSiUnitName.pxx"
+#include "RWStepBasic_RWSiPrefix.pxx"
+
 RWStepBasic_RWSiUnitAndPlaneAngleUnit::RWStepBasic_RWSiUnitAndPlaneAngleUnit() {}
 
 void RWStepBasic_RWSiUnitAndPlaneAngleUnit::ReadStep(
@@ -50,15 +52,14 @@ void RWStepBasic_RWSiUnitAndPlaneAngleUnit::ReadStep(
     return;
 
   // --- field : prefix ---
-  RWStepBasic_RWSiUnit reader;
-  StepBasic_SiPrefix   aPrefix    = StepBasic_spExa;
-  Standard_Boolean     hasAprefix = Standard_False;
+  StepBasic_SiPrefix aPrefix    = StepBasic_spExa;
+  Standard_Boolean   hasAprefix = Standard_False;
   if (data->IsParamDefined(num, 1))
   {
     if (data->ParamType(num, 1) == Interface_ParamEnum)
     {
       Standard_CString text = data->ParamCValue(num, 1);
-      hasAprefix            = reader.DecodePrefix(aPrefix, text);
+      hasAprefix            = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
       if (!hasAprefix)
       {
         ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -77,7 +78,7 @@ void RWStepBasic_RWSiUnitAndPlaneAngleUnit::ReadStep(
   if (data->ParamType(num, 2) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 2);
-    if (!reader.DecodeName(aName, text))
+    if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
     {
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
       return;
@@ -111,13 +112,12 @@ void RWStepBasic_RWSiUnitAndPlaneAngleUnit::WriteStep(
   SW.StartEntity("SI_UNIT");
 
   // --- field : prefix ---
-  RWStepBasic_RWSiUnit writer;
-  Standard_Boolean     hasAprefix = ent->HasPrefix();
+  Standard_Boolean hasAprefix = ent->HasPrefix();
   if (hasAprefix)
-    SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
+    SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
   else
     SW.SendUndef();
 
   // --- field : name ---
-  SW.SendEnum(writer.EncodeName(ent->Name()));
+  SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
 }
index 7a0d2764a71412810e67273cef0828e93a176f31..a68e4cdc2df99c2c445826db5c5041599bafba81 100644 (file)
@@ -11,7 +11,6 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include "RWStepBasic_RWSiUnit.pxx"
 #include "RWStepBasic_RWSiUnitAndRatioUnit.pxx"
 #include <StepBasic_DimensionalExponents.hxx>
 #include <StepBasic_SiPrefix.hxx>
@@ -20,6 +19,9 @@
 #include <StepData_StepReaderData.hxx>
 #include <StepData_StepWriter.hxx>
 
+#include "RWStepBasic_RWSiUnitName.pxx"
+#include "RWStepBasic_RWSiPrefix.pxx"
+
 RWStepBasic_RWSiUnitAndRatioUnit::RWStepBasic_RWSiUnitAndRatioUnit() {}
 
 void RWStepBasic_RWSiUnitAndRatioUnit::ReadStep(
@@ -51,15 +53,14 @@ void RWStepBasic_RWSiUnitAndRatioUnit::ReadStep(
     return;
 
   // --- field : prefix ---
-  RWStepBasic_RWSiUnit reader;
-  StepBasic_SiPrefix   aPrefix    = StepBasic_spExa;
-  Standard_Boolean     hasAprefix = Standard_False;
+  StepBasic_SiPrefix aPrefix    = StepBasic_spExa;
+  Standard_Boolean   hasAprefix = Standard_False;
   if (data->IsParamDefined(num, 1))
   {
     if (data->ParamType(num, 1) == Interface_ParamEnum)
     {
       Standard_CString text = data->ParamCValue(num, 1);
-      hasAprefix            = reader.DecodePrefix(aPrefix, text);
+      hasAprefix            = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
       if (!hasAprefix)
       {
         ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -78,7 +79,7 @@ void RWStepBasic_RWSiUnitAndRatioUnit::ReadStep(
   if (data->ParamType(num, 2) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 2);
-    if (!reader.DecodeName(aName, text))
+    if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
     {
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
       return;
@@ -112,13 +113,12 @@ void RWStepBasic_RWSiUnitAndRatioUnit::WriteStep(
   SW.StartEntity("SI_UNIT");
 
   // --- field : prefix ---
-  RWStepBasic_RWSiUnit writer;
-  Standard_Boolean     hasAprefix = ent->HasPrefix();
+  Standard_Boolean hasAprefix = ent->HasPrefix();
   if (hasAprefix)
-    SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
+    SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
   else
     SW.SendUndef();
 
   // --- field : name ---
-  SW.SendEnum(writer.EncodeName(ent->Name()));
+  SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
 }
index 430aff43d817e069a7b48176351c0e228a63cab4..8fd2d3a9a8e4784791479a684dafaf7f13af18c0 100644 (file)
@@ -11,7 +11,6 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include "RWStepBasic_RWSiUnit.pxx"
 #include "RWStepBasic_RWSiUnitAndSolidAngleUnit.pxx"
 #include <StepBasic_DimensionalExponents.hxx>
 #include <StepBasic_SiPrefix.hxx>
@@ -20,6 +19,9 @@
 #include <StepData_StepReaderData.hxx>
 #include <StepData_StepWriter.hxx>
 
+#include "RWStepBasic_RWSiUnitName.pxx"
+#include "RWStepBasic_RWSiPrefix.pxx"
+
 RWStepBasic_RWSiUnitAndSolidAngleUnit::RWStepBasic_RWSiUnitAndSolidAngleUnit() {}
 
 void RWStepBasic_RWSiUnitAndSolidAngleUnit::ReadStep(
@@ -45,15 +47,14 @@ void RWStepBasic_RWSiUnitAndSolidAngleUnit::ReadStep(
     return;
 
   // --- field : prefix ---
-  RWStepBasic_RWSiUnit reader;
-  StepBasic_SiPrefix   aPrefix    = StepBasic_spExa;
-  Standard_Boolean     hasAprefix = Standard_False;
+  StepBasic_SiPrefix aPrefix    = StepBasic_spExa;
+  Standard_Boolean   hasAprefix = Standard_False;
   if (data->IsParamDefined(num, 1))
   {
     if (data->ParamType(num, 1) == Interface_ParamEnum)
     {
       Standard_CString text = data->ParamCValue(num, 1);
-      hasAprefix            = reader.DecodePrefix(aPrefix, text);
+      hasAprefix            = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
       if (!hasAprefix)
       {
         ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -72,7 +73,7 @@ void RWStepBasic_RWSiUnitAndSolidAngleUnit::ReadStep(
   if (data->ParamType(num, 2) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 2);
-    if (!reader.DecodeName(aName, text))
+    if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
     {
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
       return;
@@ -108,15 +109,14 @@ void RWStepBasic_RWSiUnitAndSolidAngleUnit::WriteStep(
   SW.StartEntity("SI_UNIT");
 
   // --- field : prefix ---
-  RWStepBasic_RWSiUnit writer;
-  Standard_Boolean     hasAprefix = ent->HasPrefix();
+  Standard_Boolean hasAprefix = ent->HasPrefix();
   if (hasAprefix)
-    SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
+    SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
   else
     SW.SendUndef();
 
   // --- field : name ---
-  SW.SendEnum(writer.EncodeName(ent->Name()));
+  SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
 
   // --- Instance of plex component SolidAngleUnit ---
   SW.StartEntity("SOLID_ANGLE_UNIT");
index 543c78619aee054d3188664ff60633c6f70e2788..f93cc9aecddaf88f5c71a41f1665ce19bf3e4eec 100644 (file)
@@ -11,7 +11,6 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include "RWStepBasic_RWSiUnit.pxx"
 #include "RWStepBasic_RWSiUnitAndThermodynamicTemperatureUnit.pxx"
 #include <StepBasic_DimensionalExponents.hxx>
 #include <StepBasic_SiPrefix.hxx>
@@ -20,6 +19,9 @@
 #include <StepData_StepReaderData.hxx>
 #include <StepData_StepWriter.hxx>
 
+#include "RWStepBasic_RWSiUnitName.pxx"
+#include "RWStepBasic_RWSiPrefix.pxx"
+
 //=================================================================================================
 
 RWStepBasic_RWSiUnitAndThermodynamicTemperatureUnit::
@@ -52,15 +54,14 @@ void RWStepBasic_RWSiUnitAndThermodynamicTemperatureUnit::ReadStep(
     return;
 
   // --- field : prefix ---
-  RWStepBasic_RWSiUnit reader;
-  StepBasic_SiPrefix   aPrefix    = StepBasic_spExa;
-  Standard_Boolean     hasAprefix = Standard_False;
+  StepBasic_SiPrefix aPrefix    = StepBasic_spExa;
+  Standard_Boolean   hasAprefix = Standard_False;
   if (data->IsParamDefined(num, 1))
   {
     if (data->ParamType(num, 1) == Interface_ParamEnum)
     {
       Standard_CString text = data->ParamCValue(num, 1);
-      hasAprefix            = reader.DecodePrefix(aPrefix, text);
+      hasAprefix            = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
       if (!hasAprefix)
       {
         ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -79,7 +80,7 @@ void RWStepBasic_RWSiUnitAndThermodynamicTemperatureUnit::ReadStep(
   if (data->ParamType(num, 2) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 2);
-    if (!reader.DecodeName(aName, text))
+    if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
     {
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
       return;
@@ -117,15 +118,14 @@ void RWStepBasic_RWSiUnitAndThermodynamicTemperatureUnit::WriteStep(
   SW.StartEntity("SI_UNIT");
 
   // --- field : prefix ---
-  RWStepBasic_RWSiUnit writer;
-  Standard_Boolean     hasAprefix = ent->HasPrefix();
+  Standard_Boolean hasAprefix = ent->HasPrefix();
   if (hasAprefix)
-    SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
+    SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
   else
     SW.SendUndef();
 
   // --- field : name ---
-  SW.SendEnum(writer.EncodeName(ent->Name()));
+  SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
 
   // --- Instance of plex component SolidAngleUnit ---
   SW.StartEntity("THERMODYNAMIC_TEMPERATURE_UNIT");
index 76514d4b7ab4f6ec8446651e1ab23f1bcbd80f67..feacb069f3f6c930ebdfc0279420908947400001 100644 (file)
@@ -11,7 +11,6 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include "RWStepBasic_RWSiUnit.pxx"
 #include "RWStepBasic_RWSiUnitAndTimeUnit.pxx"
 #include <StepBasic_DimensionalExponents.hxx>
 #include <StepBasic_SiPrefix.hxx>
@@ -20,6 +19,9 @@
 #include <StepData_StepReaderData.hxx>
 #include <StepData_StepWriter.hxx>
 
+#include "RWStepBasic_RWSiUnitName.pxx"
+#include "RWStepBasic_RWSiPrefix.pxx"
+
 //=================================================================================================
 
 RWStepBasic_RWSiUnitAndTimeUnit::RWStepBasic_RWSiUnitAndTimeUnit() {}
@@ -48,15 +50,14 @@ void RWStepBasic_RWSiUnitAndTimeUnit::ReadStep(const Handle(StepData_StepReaderD
     return;
 
   // --- field : prefix ---
-  RWStepBasic_RWSiUnit reader;
-  StepBasic_SiPrefix   aPrefix    = StepBasic_spExa;
-  Standard_Boolean     hasAprefix = Standard_False;
+  StepBasic_SiPrefix aPrefix    = StepBasic_spExa;
+  Standard_Boolean   hasAprefix = Standard_False;
   if (data->IsParamDefined(num, 1))
   {
     if (data->ParamType(num, 1) == Interface_ParamEnum)
     {
       Standard_CString text = data->ParamCValue(num, 1);
-      hasAprefix            = reader.DecodePrefix(aPrefix, text);
+      hasAprefix            = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
       if (!hasAprefix)
       {
         ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -75,7 +76,7 @@ void RWStepBasic_RWSiUnitAndTimeUnit::ReadStep(const Handle(StepData_StepReaderD
   if (data->ParamType(num, 2) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 2);
-    if (!reader.DecodeName(aName, text))
+    if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
     {
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
       return;
@@ -117,15 +118,14 @@ void RWStepBasic_RWSiUnitAndTimeUnit::WriteStep(
   SW.StartEntity("SI_UNIT");
 
   // --- field : prefix ---
-  RWStepBasic_RWSiUnit writer;
-  Standard_Boolean     hasAprefix = ent->HasPrefix();
+  Standard_Boolean hasAprefix = ent->HasPrefix();
   if (hasAprefix)
-    SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
+    SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
   else
     SW.SendUndef();
 
   // --- field : name ---
-  SW.SendEnum(writer.EncodeName(ent->Name()));
+  SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
 
   // --- Instance of plex component TimeUnit ---
   SW.StartEntity("TIME_UNIT");
index 132a480bb3e0b85fc3145c84b97b60170f609a67..5f24c0d4c363308948f88fdcb802022a1e48ee44 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include "RWStepBasic_RWSiUnit.pxx"
 #include "RWStepBasic_RWSiUnitAndVolumeUnit.pxx"
 #include <StepBasic_DimensionalExponents.hxx>
 #include <StepBasic_SiUnitAndVolumeUnit.hxx>
 #include <StepData_StepReaderData.hxx>
 #include <StepData_StepWriter.hxx>
 
+#include "RWStepBasic_RWSiUnitName.pxx"
+#include "RWStepBasic_RWSiPrefix.pxx"
+
 RWStepBasic_RWSiUnitAndVolumeUnit::RWStepBasic_RWSiUnitAndVolumeUnit() {}
 
 void RWStepBasic_RWSiUnitAndVolumeUnit::ReadStep(
@@ -45,15 +47,14 @@ void RWStepBasic_RWSiUnitAndVolumeUnit::ReadStep(
   if (!data->CheckNbParams(num, 2, ach, "si_unit"))
     return;
 
-  RWStepBasic_RWSiUnit reader;
-  StepBasic_SiPrefix   aPrefix    = StepBasic_spExa;
-  Standard_Boolean     hasAprefix = Standard_False;
+  StepBasic_SiPrefix aPrefix    = StepBasic_spExa;
+  Standard_Boolean   hasAprefix = Standard_False;
   if (data->IsParamDefined(num, 1))
   {
     if (data->ParamType(num, 1) == Interface_ParamEnum)
     {
       Standard_CString text = data->ParamCValue(num, 1);
-      hasAprefix            = reader.DecodePrefix(aPrefix, text);
+      hasAprefix            = RWStepBasic_RWSiPrefix::ConvertToEnum(text, aPrefix);
       if (!hasAprefix)
       {
         ach->AddFail("Enumeration si_prefix has not an allowed value");
@@ -71,7 +72,7 @@ void RWStepBasic_RWSiUnitAndVolumeUnit::ReadStep(
   if (data->ParamType(num, 2) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 2);
-    if (!reader.DecodeName(aName, text))
+    if (!RWStepBasic_RWSiUnitName::ConvertToEnum(text, aName))
     {
       ach->AddFail("Enumeration si_unit_name has not an allowed value");
       return;
@@ -99,13 +100,12 @@ void RWStepBasic_RWSiUnitAndVolumeUnit::WriteStep(
   SW.Send(ent->Dimensions());
   SW.StartEntity("SI_UNIT");
 
-  RWStepBasic_RWSiUnit writer;
-  Standard_Boolean     hasAprefix = ent->HasPrefix();
+  Standard_Boolean hasAprefix = ent->HasPrefix();
   if (hasAprefix)
-    SW.SendEnum(writer.EncodePrefix(ent->Prefix()));
+    SW.SendEnum(RWStepBasic_RWSiPrefix::ConvertToString(ent->Prefix()));
   else
     SW.SendUndef();
 
-  SW.SendEnum(writer.EncodeName(ent->Name()));
+  SW.SendEnum(RWStepBasic_RWSiUnitName::ConvertToString(ent->Name()));
   SW.StartEntity("VOLUME_UNIT");
 }
diff --git a/src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiUnitName.pxx b/src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSiUnitName.pxx
new file mode 100644 (file)
index 0000000..4c6c0a6
--- /dev/null
@@ -0,0 +1,244 @@
+// Copyright (c) 2025 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 _RWStepBasic_RWSiUnitName_HeaderFile
+#define _RWStepBasic_RWSiUnitName_HeaderFile
+
+#include <StepBasic_SiUnitName.hxx>
+#include <Standard_CString.hxx>
+
+namespace RWStepBasic_RWSiUnitName
+{
+static constexpr char sunHertz[]         = ".HERTZ.";
+static constexpr char sunDegreeCelsius[] = ".DEGREE_CELSIUS.";
+static constexpr char sunSiemens[]       = ".SIEMENS.";
+static constexpr char sunSievert[]       = ".SIEVERT.";
+static constexpr char sunLux[]           = ".LUX.";
+static constexpr char sunWatt[]          = ".WATT.";
+static constexpr char sunOhm[]           = ".OHM.";
+static constexpr char sunSecond[]        = ".SECOND.";
+static constexpr char sunBecquerel[]     = ".BECQUEREL.";
+static constexpr char sunPascal[]        = ".PASCAL.";
+static constexpr char sunHenry[]         = ".HENRY.";
+static constexpr char sunTesla[]         = ".TESLA.";
+static constexpr char sunVolt[]          = ".VOLT.";
+static constexpr char sunJoule[]         = ".JOULE.";
+static constexpr char sunKelvin[]        = ".KELVIN.";
+static constexpr char sunAmpere[]        = ".AMPERE.";
+static constexpr char sunGram[]          = ".GRAM.";
+static constexpr char sunSteradian[]     = ".STERADIAN.";
+static constexpr char sunMole[]          = ".MOLE.";
+static constexpr char sunLumen[]         = ".LUMEN.";
+static constexpr char sunGray[]          = ".GRAY.";
+static constexpr char sunCandela[]       = ".CANDELA.";
+static constexpr char sunFarad[]         = ".FARAD.";
+static constexpr char sunRadian[]        = ".RADIAN.";
+static constexpr char sunNewton[]        = ".NEWTON.";
+static constexpr char sunMetre[]         = ".METRE.";
+static constexpr char sunWeber[]         = ".WEBER.";
+static constexpr char sunCoulomb[]       = ".COULOMB.";
+
+//! Convert StepBasic_SiUnitName to string
+//! @param theNameEnum The StepBasic_SiUnitName value to convert
+//! @return The corresponding string representation
+inline const char* ConvertToString(const StepBasic_SiUnitName theNameEnum)
+{
+  switch (theNameEnum)
+  {
+    case StepBasic_sunHertz:
+      return sunHertz;
+    case StepBasic_sunDegreeCelsius:
+      return sunDegreeCelsius;
+    case StepBasic_sunSiemens:
+      return sunSiemens;
+    case StepBasic_sunSievert:
+      return sunSievert;
+    case StepBasic_sunLux:
+      return sunLux;
+    case StepBasic_sunWatt:
+      return sunWatt;
+    case StepBasic_sunOhm:
+      return sunOhm;
+    case StepBasic_sunSecond:
+      return sunSecond;
+    case StepBasic_sunBecquerel:
+      return sunBecquerel;
+    case StepBasic_sunPascal:
+      return sunPascal;
+    case StepBasic_sunHenry:
+      return sunHenry;
+    case StepBasic_sunTesla:
+      return sunTesla;
+    case StepBasic_sunVolt:
+      return sunVolt;
+    case StepBasic_sunJoule:
+      return sunJoule;
+    case StepBasic_sunKelvin:
+      return sunKelvin;
+    case StepBasic_sunAmpere:
+      return sunAmpere;
+    case StepBasic_sunGram:
+      return sunGram;
+    case StepBasic_sunSteradian:
+      return sunSteradian;
+    case StepBasic_sunMole:
+      return sunMole;
+    case StepBasic_sunLumen:
+      return sunLumen;
+    case StepBasic_sunGray:
+      return sunGray;
+    case StepBasic_sunCandela:
+      return sunCandela;
+    case StepBasic_sunFarad:
+      return sunFarad;
+    case StepBasic_sunRadian:
+      return sunRadian;
+    case StepBasic_sunNewton:
+      return sunNewton;
+    case StepBasic_sunMetre:
+      return sunMetre;
+    case StepBasic_sunWeber:
+      return sunWeber;
+    case StepBasic_sunCoulomb:
+      return sunCoulomb;
+  }
+  return nullptr; // Default value
+}
+
+//! Convert string to StepBasic_SiUnitName
+//! @param theNameStr The string to convert
+//! @param theResultEnum The corresponding StepBasic_SiUnitName value
+//! @return Standard_True if the conversion was successful, Standard_False otherwise
+inline bool ConvertToEnum(const Standard_CString theNameStr, StepBasic_SiUnitName& theResultEnum)
+{
+  if (IsEqual(theNameStr, sunHertz))
+  {
+    theResultEnum = StepBasic_sunHertz;
+  }
+  else if (IsEqual(theNameStr, sunDegreeCelsius))
+  {
+    theResultEnum = StepBasic_sunDegreeCelsius;
+  }
+  else if (IsEqual(theNameStr, sunSiemens))
+  {
+    theResultEnum = StepBasic_sunSiemens;
+  }
+  else if (IsEqual(theNameStr, sunSievert))
+  {
+    theResultEnum = StepBasic_sunSievert;
+  }
+  else if (IsEqual(theNameStr, sunLux))
+  {
+    theResultEnum = StepBasic_sunLux;
+  }
+  else if (IsEqual(theNameStr, sunWatt))
+  {
+    theResultEnum = StepBasic_sunWatt;
+  }
+  else if (IsEqual(theNameStr, sunOhm))
+  {
+    theResultEnum = StepBasic_sunOhm;
+  }
+  else if (IsEqual(theNameStr, sunSecond))
+  {
+    theResultEnum = StepBasic_sunSecond;
+  }
+  else if (IsEqual(theNameStr, sunBecquerel))
+  {
+    theResultEnum = StepBasic_sunBecquerel;
+  }
+  else if (IsEqual(theNameStr, sunPascal))
+  {
+    theResultEnum = StepBasic_sunPascal;
+  }
+  else if (IsEqual(theNameStr, sunHenry))
+  {
+    theResultEnum = StepBasic_sunHenry;
+  }
+  else if (IsEqual(theNameStr, sunTesla))
+  {
+    theResultEnum = StepBasic_sunTesla;
+  }
+  else if (IsEqual(theNameStr, sunVolt))
+  {
+    theResultEnum = StepBasic_sunVolt;
+  }
+  else if (IsEqual(theNameStr, sunJoule))
+  {
+    theResultEnum = StepBasic_sunJoule;
+  }
+  else if (IsEqual(theNameStr, sunKelvin))
+  {
+    theResultEnum = StepBasic_sunKelvin;
+  }
+  else if (IsEqual(theNameStr, sunAmpere))
+  {
+    theResultEnum = StepBasic_sunAmpere;
+  }
+  else if (IsEqual(theNameStr, sunGram))
+  {
+    theResultEnum = StepBasic_sunGram;
+  }
+  else if (IsEqual(theNameStr, sunSteradian))
+  {
+    theResultEnum = StepBasic_sunSteradian;
+  }
+  else if (IsEqual(theNameStr, sunMole))
+  {
+    theResultEnum = StepBasic_sunMole;
+  }
+  else if (IsEqual(theNameStr, sunLumen))
+  {
+    theResultEnum = StepBasic_sunLumen;
+  }
+  else if (IsEqual(theNameStr, sunGray))
+  {
+    theResultEnum = StepBasic_sunGray;
+  }
+  else if (IsEqual(theNameStr, sunCandela))
+  {
+    theResultEnum = StepBasic_sunCandela;
+  }
+  else if (IsEqual(theNameStr, sunFarad))
+  {
+    theResultEnum = StepBasic_sunFarad;
+  }
+  else if (IsEqual(theNameStr, sunRadian))
+  {
+    theResultEnum = StepBasic_sunRadian;
+  }
+  else if (IsEqual(theNameStr, sunNewton))
+  {
+    theResultEnum = StepBasic_sunNewton;
+  }
+  else if (IsEqual(theNameStr, sunMetre))
+  {
+    theResultEnum = StepBasic_sunMetre;
+  }
+  else if (IsEqual(theNameStr, sunWeber))
+  {
+    theResultEnum = StepBasic_sunWeber;
+  }
+  else if (IsEqual(theNameStr, sunCoulomb))
+  {
+    theResultEnum = StepBasic_sunCoulomb;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+
+} // namespace RWStepBasic_RWSiUnitName
+#endif // _RWStepBasic_RWSiUnitName_HeaderFile
diff --git a/src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSource.pxx b/src/DataExchange/TKDESTEP/RWStepBasic/RWStepBasic_RWSource.pxx
new file mode 100644 (file)
index 0000000..afc5a45
--- /dev/null
@@ -0,0 +1,69 @@
+// Copyright (c) 2025 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 _RWStepBasic_RWSource_HeaderFile
+#define _RWStepBasic_RWSource_HeaderFile
+
+#include <StepBasic_Source.hxx>
+#include <Standard_CString.hxx>
+
+namespace RWStepBasic_RWSource
+{
+static constexpr char sBought[]   = ".BOUGHT.";
+static constexpr char sNotKnown[] = ".NOT_KNOWN.";
+static constexpr char sMade[]     = ".MADE.";
+
+//! Convert StepBasic_Source to string
+//! @param theSourceEnum The StepBasic_Source value to convert
+//! @return The corresponding string representation or nullptr if not found
+inline const char* ConvertToString(const StepBasic_Source theSourceEnum)
+{
+  switch (theSourceEnum)
+  {
+    case StepBasic_sBought:
+      return sBought;
+    case StepBasic_sNotKnown:
+      return sNotKnown;
+    case StepBasic_sMade:
+      return sMade;
+  }
+  return nullptr;
+}
+
+//! Convert string to StepBasic_Source
+//! @param theSourceStr The string to convert
+//! @param theResultEnum The corresponding StepBasic_Source value
+//! @return Standard_True if the conversion was successful, Standard_False otherwise
+inline bool ConvertToEnum(const Standard_CString theSourceStr, StepBasic_Source& theResultEnum)
+{
+  if (IsEqual(theSourceStr, sBought))
+  {
+    theResultEnum = StepBasic_sBought;
+  }
+  else if (IsEqual(theSourceStr, sNotKnown))
+  {
+    theResultEnum = StepBasic_sNotKnown;
+  }
+  else if (IsEqual(theSourceStr, sMade))
+  {
+    theResultEnum = StepBasic_sMade;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+} // namespace RWStepBasic_RWSource
+
+#endif // _RWStepBasic_RWSource_HeaderFile
index e49f02a5ba6c8bb262e8b73f0c49adfb8da47cec..e55acd66e42a5bd7c0b0c1d1cb08242df502123b 100644 (file)
@@ -25,12 +25,14 @@ set(OCCT_RWStepGeom_FILES
   RWStepGeom_RWBSplineCurve.cxx
   RWStepGeom_RWBSplineCurve.pxx
   RWStepGeom_RWBSplineCurveWithKnots.cxx
+  RWStepGeom_RWBSplineCurveForm.pxx
   RWStepGeom_RWBSplineCurveWithKnots.pxx
   RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve.cxx
   RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve.pxx
   RWStepGeom_RWBSplineSurface.cxx
   RWStepGeom_RWBSplineSurface.pxx
   RWStepGeom_RWBSplineSurfaceWithKnots.cxx
+  RWStepGeom_RWBSplineSurfaceForm.pxx
   RWStepGeom_RWBSplineSurfaceWithKnots.pxx
   RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface.cxx
   RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface.pxx
@@ -86,6 +88,7 @@ set(OCCT_RWStepGeom_FILES
   RWStepGeom_RWHyperbola.pxx
   RWStepGeom_RWIntersectionCurve.cxx
   RWStepGeom_RWIntersectionCurve.pxx
+  RWStepGeom_RWKnotType.pxx
   RWStepGeom_RWLine.cxx
   RWStepGeom_RWLine.pxx
   RWStepGeom_RWOffsetCurve3d.cxx
@@ -114,6 +117,7 @@ set(OCCT_RWStepGeom_FILES
   RWStepGeom_RWPointReplica.pxx
   RWStepGeom_RWPolyline.cxx
   RWStepGeom_RWPolyline.pxx
+  RWStepGeom_RWPreferredSurfaceCurveRepresentation.pxx
   RWStepGeom_RWQuasiUniformCurve.cxx
   RWStepGeom_RWQuasiUniformCurve.pxx
   RWStepGeom_RWQuasiUniformCurveAndRationalBSplineCurve.cxx
@@ -156,6 +160,7 @@ set(OCCT_RWStepGeom_FILES
   RWStepGeom_RWSweptSurface.pxx
   RWStepGeom_RWToroidalSurface.cxx
   RWStepGeom_RWToroidalSurface.pxx
+  RWStepGeom_RWTransitionCode.pxx
   RWStepGeom_RWTrimmedCurve.cxx
   RWStepGeom_RWTrimmedCurve.pxx
   RWStepGeom_RWUniformCurve.cxx
index f94d1f219cbbac2144bf48fc1b7a571b11ae9162..4f9ff143a827cebc78df78c82157271f5b7800f8 100644 (file)
 #include <StepGeom_HArray1OfCartesianPoint.hxx>
 #include <TCollection_AsciiString.hxx>
 
-// --- Enum : BSplineCurveForm ---
-static TCollection_AsciiString bscfEllipticArc(".ELLIPTIC_ARC.");
-static TCollection_AsciiString bscfPolylineForm(".POLYLINE_FORM.");
-static TCollection_AsciiString bscfParabolicArc(".PARABOLIC_ARC.");
-static TCollection_AsciiString bscfCircularArc(".CIRCULAR_ARC.");
-static TCollection_AsciiString bscfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bscfHyperbolicArc(".HYPERBOLIC_ARC.");
+#include "RWStepGeom_RWBSplineCurveForm.pxx"
 
 RWStepGeom_RWBSplineCurve::RWStepGeom_RWBSplineCurve() {}
 
@@ -83,20 +77,10 @@ void RWStepGeom_RWBSplineCurve::ReadStep(const Handle(StepData_StepReaderData)&
   if (data->ParamType(num, 4) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 4);
-    if (bscfEllipticArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfEllipticArc;
-    else if (bscfPolylineForm.IsEqual(text))
-      aCurveForm = StepGeom_bscfPolylineForm;
-    else if (bscfParabolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfParabolicArc;
-    else if (bscfCircularArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfCircularArc;
-    else if (bscfUnspecified.IsEqual(text))
-      aCurveForm = StepGeom_bscfUnspecified;
-    else if (bscfHyperbolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfHyperbolicArc;
-    else
+    if (!RWStepGeom_RWBSplineCurveForm::ConvertToEnum(text, aCurveForm))
+    {
       ach->AddFail("Enumeration b_spline_curve_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #4 (curve_form) is not an enumeration");
@@ -141,27 +125,7 @@ void RWStepGeom_RWBSplineCurve::WriteStep(StepData_StepWriter&                 S
 
   // --- own field : curveForm ---
 
-  switch (ent->CurveForm())
-  {
-    case StepGeom_bscfEllipticArc:
-      SW.SendEnum(bscfEllipticArc);
-      break;
-    case StepGeom_bscfPolylineForm:
-      SW.SendEnum(bscfPolylineForm);
-      break;
-    case StepGeom_bscfParabolicArc:
-      SW.SendEnum(bscfParabolicArc);
-      break;
-    case StepGeom_bscfCircularArc:
-      SW.SendEnum(bscfCircularArc);
-      break;
-    case StepGeom_bscfUnspecified:
-      SW.SendEnum(bscfUnspecified);
-      break;
-    case StepGeom_bscfHyperbolicArc:
-      SW.SendEnum(bscfHyperbolicArc);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineCurveForm::ConvertToString(ent->CurveForm()));
 
   // --- own field : closedCurve ---
 
diff --git a/src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWBSplineCurveForm.pxx b/src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWBSplineCurveForm.pxx
new file mode 100644 (file)
index 0000000..54b8d16
--- /dev/null
@@ -0,0 +1,91 @@
+// Copyright (c) 2025 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 _RWStepGeom_RWBSplineCurveForm_HeaderFile
+#define _RWStepGeom_RWBSplineCurveForm_HeaderFile
+
+#include <StepGeom_BSplineCurveForm.hxx>
+#include <Standard_CString.hxx>
+
+namespace RWStepGeom_RWBSplineCurveForm
+{
+static constexpr char bscfEllipticArc[]   = ".ELLIPTIC_ARC.";
+static constexpr char bscfPolylineForm[]  = ".POLYLINE_FORM.";
+static constexpr char bscfParabolicArc[]  = ".PARABOLIC_ARC.";
+static constexpr char bscfCircularArc[]   = ".CIRCULAR_ARC.";
+static constexpr char bscfUnspecified[]   = ".UNSPECIFIED.";
+static constexpr char bscfHyperbolicArc[] = ".HYPERBOLIC_ARC.";
+
+//! Convert StepGeom_BSplineCurveForm to string
+//! @param theSourceEnum The StepGeom_BSplineCurveForm value to convert
+//! @return The corresponding string representation or nullptr if not found
+inline const char* ConvertToString(const StepGeom_BSplineCurveForm theSourceEnum)
+{
+  switch (theSourceEnum)
+  {
+    case StepGeom_bscfEllipticArc:
+      return bscfEllipticArc;
+    case StepGeom_bscfPolylineForm:
+      return bscfPolylineForm;
+    case StepGeom_bscfParabolicArc:
+      return bscfParabolicArc;
+    case StepGeom_bscfCircularArc:
+      return bscfCircularArc;
+    case StepGeom_bscfUnspecified:
+      return bscfUnspecified;
+    case StepGeom_bscfHyperbolicArc:
+      return bscfHyperbolicArc;
+  }
+  return nullptr;
+}
+
+//! Convert string to StepGeom_BSplineCurveForm
+//! @param theFormString The string to convert
+//! @param theResultEnum The corresponding StepGeom_BSplineCurveForm value
+//! @return Standard_True if the conversion was successful, Standard_False otherwise
+inline bool ConvertToEnum(const Standard_CString     theFormString,
+                          StepGeom_BSplineCurveForm& theResultEnum)
+{
+  if (IsEqual(theFormString, bscfEllipticArc))
+  {
+    theResultEnum = StepGeom_bscfEllipticArc;
+  }
+  else if (IsEqual(theFormString, bscfPolylineForm))
+  {
+    theResultEnum = StepGeom_bscfPolylineForm;
+  }
+  else if (IsEqual(theFormString, bscfParabolicArc))
+  {
+    theResultEnum = StepGeom_bscfParabolicArc;
+  }
+  else if (IsEqual(theFormString, bscfCircularArc))
+  {
+    theResultEnum = StepGeom_bscfCircularArc;
+  }
+  else if (IsEqual(theFormString, bscfUnspecified))
+  {
+    theResultEnum = StepGeom_bscfUnspecified;
+  }
+  else if (IsEqual(theFormString, bscfHyperbolicArc))
+  {
+    theResultEnum = StepGeom_bscfHyperbolicArc;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+} // namespace RWStepGeom_RWBSplineCurveForm
+
+#endif // _RWStepGeom_RWBSplineCurveForm_HeaderFile
index 7db8774702846a85adafc99da6dfccb88f096a42..1f3a94172943613289fbb0975f0e4fe39bd02a65 100644 (file)
 #include <TColStd_HArray1OfInteger.hxx>
 #include <TColStd_HArray1OfReal.hxx>
 
-// --- Enum : KnotType ---
-static TCollection_AsciiString ktUniformKnots(".UNIFORM_KNOTS.");
-static TCollection_AsciiString ktQuasiUniformKnots(".QUASI_UNIFORM_KNOTS.");
-static TCollection_AsciiString ktPiecewiseBezierKnots(".PIECEWISE_BEZIER_KNOTS.");
-static TCollection_AsciiString ktUnspecified(".UNSPECIFIED.");
-
-// --- Enum : BSplineCurveForm ---
-static TCollection_AsciiString bscfEllipticArc(".ELLIPTIC_ARC.");
-static TCollection_AsciiString bscfPolylineForm(".POLYLINE_FORM.");
-static TCollection_AsciiString bscfParabolicArc(".PARABOLIC_ARC.");
-static TCollection_AsciiString bscfCircularArc(".CIRCULAR_ARC.");
-static TCollection_AsciiString bscfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bscfHyperbolicArc(".HYPERBOLIC_ARC.");
+#include "RWStepGeom_RWBSplineCurveForm.pxx"
+#include "RWStepGeom_RWKnotType.pxx"
 
 RWStepGeom_RWBSplineCurveWithKnots::RWStepGeom_RWBSplineCurveWithKnots() {}
 
@@ -98,20 +87,10 @@ void RWStepGeom_RWBSplineCurveWithKnots::ReadStep(
   if (data->ParamType(num, 4) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 4);
-    if (bscfEllipticArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfEllipticArc;
-    else if (bscfPolylineForm.IsEqual(text))
-      aCurveForm = StepGeom_bscfPolylineForm;
-    else if (bscfParabolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfParabolicArc;
-    else if (bscfCircularArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfCircularArc;
-    else if (bscfUnspecified.IsEqual(text))
-      aCurveForm = StepGeom_bscfUnspecified;
-    else if (bscfHyperbolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfHyperbolicArc;
-    else
+    if (!RWStepGeom_RWBSplineCurveForm::ConvertToEnum(text, aCurveForm))
+    {
       ach->AddFail("Enumeration b_spline_curve_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #4 (curve_form) is not an enumeration");
@@ -168,16 +147,10 @@ void RWStepGeom_RWBSplineCurveWithKnots::ReadStep(
   if (data->ParamType(num, 9) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 9);
-    if (ktUniformKnots.IsEqual(text))
-      aKnotSpec = StepGeom_ktUniformKnots;
-    else if (ktQuasiUniformKnots.IsEqual(text))
-      aKnotSpec = StepGeom_ktQuasiUniformKnots;
-    else if (ktPiecewiseBezierKnots.IsEqual(text))
-      aKnotSpec = StepGeom_ktPiecewiseBezierKnots;
-    else if (ktUnspecified.IsEqual(text))
-      aKnotSpec = StepGeom_ktUnspecified;
-    else
+    if (!RWStepGeom_RWKnotType::ConvertToEnum(text, aKnotSpec))
+    {
       ach->AddFail("Enumeration knot_type has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #9 (knot_spec) is not an enumeration");
@@ -219,27 +192,7 @@ void RWStepGeom_RWBSplineCurveWithKnots::WriteStep(
 
   // --- inherited field curveForm ---
 
-  switch (ent->CurveForm())
-  {
-    case StepGeom_bscfEllipticArc:
-      SW.SendEnum(bscfEllipticArc);
-      break;
-    case StepGeom_bscfPolylineForm:
-      SW.SendEnum(bscfPolylineForm);
-      break;
-    case StepGeom_bscfParabolicArc:
-      SW.SendEnum(bscfParabolicArc);
-      break;
-    case StepGeom_bscfCircularArc:
-      SW.SendEnum(bscfCircularArc);
-      break;
-    case StepGeom_bscfUnspecified:
-      SW.SendEnum(bscfUnspecified);
-      break;
-    case StepGeom_bscfHyperbolicArc:
-      SW.SendEnum(bscfHyperbolicArc);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineCurveForm::ConvertToString(ent->CurveForm()));
 
   // --- inherited field closedCurve ---
 
@@ -269,21 +222,7 @@ void RWStepGeom_RWBSplineCurveWithKnots::WriteStep(
 
   // --- own field : knotSpec ---
 
-  switch (ent->KnotSpec())
-  {
-    case StepGeom_ktUniformKnots:
-      SW.SendEnum(ktUniformKnots);
-      break;
-    case StepGeom_ktQuasiUniformKnots:
-      SW.SendEnum(ktQuasiUniformKnots);
-      break;
-    case StepGeom_ktPiecewiseBezierKnots:
-      SW.SendEnum(ktPiecewiseBezierKnots);
-      break;
-    case StepGeom_ktUnspecified:
-      SW.SendEnum(ktUnspecified);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWKnotType::ConvertToString(ent->KnotSpec()));
 }
 
 void RWStepGeom_RWBSplineCurveWithKnots::Share(const Handle(StepGeom_BSplineCurveWithKnots)& ent,
index 634ef63395b09f04420204d998e5f40084937da8..3e8cc774edc8c9d0743598f2a219ceba2ed562b2 100644 (file)
 #include <TColStd_HArray1OfInteger.hxx>
 #include <TColStd_HArray1OfReal.hxx>
 
-// --- Enum : BSplineCurveForm ---
-static TCollection_AsciiString bscfEllipticArc(".ELLIPTIC_ARC.");
-static TCollection_AsciiString bscfPolylineForm(".POLYLINE_FORM.");
-static TCollection_AsciiString bscfParabolicArc(".PARABOLIC_ARC.");
-static TCollection_AsciiString bscfCircularArc(".CIRCULAR_ARC.");
-static TCollection_AsciiString bscfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bscfHyperbolicArc(".HYPERBOLIC_ARC.");
-
-// --- Enum : KnotType ---
-static TCollection_AsciiString ktUniformKnots(".UNIFORM_KNOTS.");
-static TCollection_AsciiString ktQuasiUniformKnots(".QUASI_UNIFORM_KNOTS.");
-static TCollection_AsciiString ktPiecewiseBezierKnots(".PIECEWISE_BEZIER_KNOTS.");
-static TCollection_AsciiString ktUnspecified(".UNSPECIFIED.");
+#include "RWStepGeom_RWBSplineCurveForm.pxx"
+#include "RWStepGeom_RWKnotType.pxx"
 
 RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve::
   RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve()
@@ -102,20 +91,10 @@ void RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve::ReadStep(
   if (data->ParamType(num, 3) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 3);
-    if (bscfEllipticArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfEllipticArc;
-    else if (bscfPolylineForm.IsEqual(text))
-      aCurveForm = StepGeom_bscfPolylineForm;
-    else if (bscfParabolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfParabolicArc;
-    else if (bscfCircularArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfCircularArc;
-    else if (bscfUnspecified.IsEqual(text))
-      aCurveForm = StepGeom_bscfUnspecified;
-    else if (bscfHyperbolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfHyperbolicArc;
-    else
+    if (!RWStepGeom_RWBSplineCurveForm::ConvertToEnum(text, aCurveForm))
+    {
       ach->AddFail("Enumeration b_spline_curve_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #3 (curve_form) is not an enumeration");
@@ -180,16 +159,10 @@ void RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve::ReadStep(
   if (data->ParamType(num, 3) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 3);
-    if (ktUniformKnots.IsEqual(text))
-      aKnotSpec = StepGeom_ktUniformKnots;
-    else if (ktQuasiUniformKnots.IsEqual(text))
-      aKnotSpec = StepGeom_ktQuasiUniformKnots;
-    else if (ktPiecewiseBezierKnots.IsEqual(text))
-      aKnotSpec = StepGeom_ktPiecewiseBezierKnots;
-    else if (ktUnspecified.IsEqual(text))
-      aKnotSpec = StepGeom_ktUnspecified;
-    else
+    if (!RWStepGeom_RWKnotType::ConvertToEnum(text, aKnotSpec))
+    {
       ach->AddFail("Enumeration knot_type has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #3 (knot_spec) is not an enumeration");
@@ -286,27 +259,8 @@ void RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve::WriteStep(
   SW.CloseSub();
   // --- field : curveForm ---
 
-  switch (ent->CurveForm())
-  {
-    case StepGeom_bscfEllipticArc:
-      SW.SendEnum(bscfEllipticArc);
-      break;
-    case StepGeom_bscfPolylineForm:
-      SW.SendEnum(bscfPolylineForm);
-      break;
-    case StepGeom_bscfParabolicArc:
-      SW.SendEnum(bscfParabolicArc);
-      break;
-    case StepGeom_bscfCircularArc:
-      SW.SendEnum(bscfCircularArc);
-      break;
-    case StepGeom_bscfUnspecified:
-      SW.SendEnum(bscfUnspecified);
-      break;
-    case StepGeom_bscfHyperbolicArc:
-      SW.SendEnum(bscfHyperbolicArc);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineCurveForm::ConvertToString(ent->CurveForm()));
+
   // --- field : closedCurve ---
 
   SW.SendLogical(ent->ClosedCurve());
@@ -335,21 +289,7 @@ void RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve::WriteStep(
   SW.CloseSub();
   // --- field : knotSpec ---
 
-  switch (ent->KnotSpec())
-  {
-    case StepGeom_ktUniformKnots:
-      SW.SendEnum(ktUniformKnots);
-      break;
-    case StepGeom_ktQuasiUniformKnots:
-      SW.SendEnum(ktQuasiUniformKnots);
-      break;
-    case StepGeom_ktPiecewiseBezierKnots:
-      SW.SendEnum(ktPiecewiseBezierKnots);
-      break;
-    case StepGeom_ktUnspecified:
-      SW.SendEnum(ktUnspecified);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWKnotType::ConvertToString(ent->KnotSpec()));
 
   // --- Instance of plex component Curve ---
 
index 99517df707de6cbfa72f7593b4e784904d394027..f89cd5ff0ed0504651930779bf2f2187db368ad9 100644 (file)
 #include <StepGeom_HArray2OfCartesianPoint.hxx>
 #include <TCollection_AsciiString.hxx>
 
-// --- Enum : BSplineSurfaceForm ---
-static TCollection_AsciiString bssfSurfOfLinearExtrusion(".SURF_OF_LINEAR_EXTRUSION.");
-static TCollection_AsciiString bssfPlaneSurf(".PLANE_SURF.");
-static TCollection_AsciiString bssfGeneralisedCone(".GENERALISED_CONE.");
-static TCollection_AsciiString bssfToroidalSurf(".TOROIDAL_SURF.");
-static TCollection_AsciiString bssfConicalSurf(".CONICAL_SURF.");
-static TCollection_AsciiString bssfSphericalSurf(".SPHERICAL_SURF.");
-static TCollection_AsciiString bssfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bssfRuledSurf(".RULED_SURF.");
-static TCollection_AsciiString bssfSurfOfRevolution(".SURF_OF_REVOLUTION.");
-static TCollection_AsciiString bssfCylindricalSurf(".CYLINDRICAL_SURF.");
-static TCollection_AsciiString bssfQuadricSurf(".QUADRIC_SURF.");
+#include "RWStepGeom_RWBSplineSurfaceForm.pxx"
 
 RWStepGeom_RWBSplineSurface::RWStepGeom_RWBSplineSurface() {}
 
@@ -102,30 +91,10 @@ void RWStepGeom_RWBSplineSurface::ReadStep(const Handle(StepData_StepReaderData)
   if (data->ParamType(num, 5) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 5);
-    if (bssfSurfOfLinearExtrusion.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfLinearExtrusion;
-    else if (bssfPlaneSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfPlaneSurf;
-    else if (bssfGeneralisedCone.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfGeneralisedCone;
-    else if (bssfToroidalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfToroidalSurf;
-    else if (bssfConicalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfConicalSurf;
-    else if (bssfSphericalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSphericalSurf;
-    else if (bssfUnspecified.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfUnspecified;
-    else if (bssfRuledSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfRuledSurf;
-    else if (bssfSurfOfRevolution.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfRevolution;
-    else if (bssfCylindricalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfCylindricalSurf;
-    else if (bssfQuadricSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfQuadricSurf;
-    else
+    if (!RWStepGeom_RWBSplineSurfaceForm::ConvertToEnum(text, aSurfaceForm))
+    {
       ach->AddFail("Enumeration b_spline_surface_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #5 (surface_form) is not an enumeration");
@@ -194,42 +163,7 @@ void RWStepGeom_RWBSplineSurface::WriteStep(StepData_StepWriter&
 
   // --- own field : surfaceForm ---
 
-  switch (ent->SurfaceForm())
-  {
-    case StepGeom_bssfSurfOfLinearExtrusion:
-      SW.SendEnum(bssfSurfOfLinearExtrusion);
-      break;
-    case StepGeom_bssfPlaneSurf:
-      SW.SendEnum(bssfPlaneSurf);
-      break;
-    case StepGeom_bssfGeneralisedCone:
-      SW.SendEnum(bssfGeneralisedCone);
-      break;
-    case StepGeom_bssfToroidalSurf:
-      SW.SendEnum(bssfToroidalSurf);
-      break;
-    case StepGeom_bssfConicalSurf:
-      SW.SendEnum(bssfConicalSurf);
-      break;
-    case StepGeom_bssfSphericalSurf:
-      SW.SendEnum(bssfSphericalSurf);
-      break;
-    case StepGeom_bssfUnspecified:
-      SW.SendEnum(bssfUnspecified);
-      break;
-    case StepGeom_bssfRuledSurf:
-      SW.SendEnum(bssfRuledSurf);
-      break;
-    case StepGeom_bssfSurfOfRevolution:
-      SW.SendEnum(bssfSurfOfRevolution);
-      break;
-    case StepGeom_bssfCylindricalSurf:
-      SW.SendEnum(bssfCylindricalSurf);
-      break;
-    case StepGeom_bssfQuadricSurf:
-      SW.SendEnum(bssfQuadricSurf);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineSurfaceForm::ConvertToString(ent->SurfaceForm()));
 
   // --- own field : uClosed ---
 
diff --git a/src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWBSplineSurfaceForm.pxx b/src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWBSplineSurfaceForm.pxx
new file mode 100644 (file)
index 0000000..0940777
--- /dev/null
@@ -0,0 +1,126 @@
+// Copyright (c) 2025 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 _RWStepGeom_RWBSplineSurfaceForm_HeaderFile
+#define _RWStepGeom_RWBSplineSurfaceForm_HeaderFile
+
+#include <StepGeom_BSplineSurfaceForm.hxx>
+#include <Standard_CString.hxx>
+
+namespace RWStepGeom_RWBSplineSurfaceForm
+{
+static constexpr char bssfSurfOfLinearExtrusion[] = (".SURF_OF_LINEAR_EXTRUSION.");
+static constexpr char bssfPlaneSurf[]             = (".PLANE_SURF.");
+static constexpr char bssfGeneralisedCone[]       = (".GENERALISED_CONE.");
+static constexpr char bssfToroidalSurf[]          = (".TOROIDAL_SURF.");
+static constexpr char bssfConicalSurf[]           = (".CONICAL_SURF.");
+static constexpr char bssfSphericalSurf[]         = (".SPHERICAL_SURF.");
+static constexpr char bssfUnspecified[]           = (".UNSPECIFIED.");
+static constexpr char bssfRuledSurf[]             = (".RULED_SURF.");
+static constexpr char bssfSurfOfRevolution[]      = (".SURF_OF_REVOLUTION.");
+static constexpr char bssfCylindricalSurf[]       = (".CYLINDRICAL_SURF.");
+static constexpr char bssfQuadricSurf[]           = (".QUADRIC_SURF.");
+
+//! Convert StepGeom_BSplineSurfaceForm to string
+//! @param theSourceEnum The StepGeom_BSplineSurfaceForm value to convert
+//! @return The corresponding string representation or nullptr if not found
+inline const char* ConvertToString(const StepGeom_BSplineSurfaceForm theSourceEnum)
+{
+  switch (theSourceEnum)
+  {
+    case StepGeom_bssfSurfOfLinearExtrusion:
+      return bssfSurfOfLinearExtrusion;
+    case StepGeom_bssfPlaneSurf:
+      return bssfPlaneSurf;
+    case StepGeom_bssfGeneralisedCone:
+      return bssfGeneralisedCone;
+    case StepGeom_bssfToroidalSurf:
+      return bssfToroidalSurf;
+    case StepGeom_bssfConicalSurf:
+      return bssfConicalSurf;
+    case StepGeom_bssfSphericalSurf:
+      return bssfSphericalSurf;
+    case StepGeom_bssfUnspecified:
+      return bssfUnspecified;
+    case StepGeom_bssfRuledSurf:
+      return bssfRuledSurf;
+    case StepGeom_bssfSurfOfRevolution:
+      return bssfSurfOfRevolution;
+    case StepGeom_bssfCylindricalSurf:
+      return bssfCylindricalSurf;
+    case StepGeom_bssfQuadricSurf:
+      return bssfQuadricSurf;
+  }
+  return nullptr;
+}
+
+//! Convert string to StepGeom_BSplineSurfaceForm
+//! @param theFormString The string to convert
+//! @param theResultEnum The corresponding StepGeom_BSplineSurfaceForm value
+//! @return Standard_True if the conversion was successful, Standard_False otherwise
+inline bool ConvertToEnum(const Standard_CString       theFormString,
+                          StepGeom_BSplineSurfaceForm& theResultEnum)
+{
+  if (IsEqual(theFormString, bssfSurfOfLinearExtrusion))
+  {
+    theResultEnum = StepGeom_bssfSurfOfLinearExtrusion;
+  }
+  else if (IsEqual(theFormString, bssfPlaneSurf))
+  {
+    theResultEnum = StepGeom_bssfPlaneSurf;
+  }
+  else if (IsEqual(theFormString, bssfGeneralisedCone))
+  {
+    theResultEnum = StepGeom_bssfGeneralisedCone;
+  }
+  else if (IsEqual(theFormString, bssfToroidalSurf))
+  {
+    theResultEnum = StepGeom_bssfToroidalSurf;
+  }
+  else if (IsEqual(theFormString, bssfConicalSurf))
+  {
+    theResultEnum = StepGeom_bssfConicalSurf;
+  }
+  else if (IsEqual(theFormString, bssfSphericalSurf))
+  {
+    theResultEnum = StepGeom_bssfSphericalSurf;
+  }
+  else if (IsEqual(theFormString, bssfUnspecified))
+  {
+    theResultEnum = StepGeom_bssfUnspecified;
+  }
+  else if (IsEqual(theFormString, bssfRuledSurf))
+  {
+    theResultEnum = StepGeom_bssfRuledSurf;
+  }
+  else if (IsEqual(theFormString, bssfSurfOfRevolution))
+  {
+    theResultEnum = StepGeom_bssfSurfOfRevolution;
+  }
+  else if (IsEqual(theFormString, bssfCylindricalSurf))
+  {
+    theResultEnum = StepGeom_bssfCylindricalSurf;
+  }
+  else if (IsEqual(theFormString, bssfQuadricSurf))
+  {
+    theResultEnum = StepGeom_bssfQuadricSurf;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+} // namespace RWStepGeom_RWBSplineSurfaceForm
+
+#endif // _RWStepGeom_RWBSplineSurfaceForm_HeaderFile
index 90f3cad6488efd2bc2c23ffe0297807d6f1c99d6..e796240f112092fc1ee254a5752175fbcf355182 100644 (file)
 #include <TColStd_HArray1OfInteger.hxx>
 #include <TColStd_HArray1OfReal.hxx>
 
-// --- Enum : KnotType ---
-static TCollection_AsciiString ktUniformKnots(".UNIFORM_KNOTS.");
-static TCollection_AsciiString ktQuasiUniformKnots(".QUASI_UNIFORM_KNOTS.");
-static TCollection_AsciiString ktPiecewiseBezierKnots(".PIECEWISE_BEZIER_KNOTS.");
-static TCollection_AsciiString ktUnspecified(".UNSPECIFIED.");
-
-// --- Enum : BSplineSurfaceForm ---
-static TCollection_AsciiString bssfSurfOfLinearExtrusion(".SURF_OF_LINEAR_EXTRUSION.");
-static TCollection_AsciiString bssfPlaneSurf(".PLANE_SURF.");
-static TCollection_AsciiString bssfGeneralisedCone(".GENERALISED_CONE.");
-static TCollection_AsciiString bssfToroidalSurf(".TOROIDAL_SURF.");
-static TCollection_AsciiString bssfConicalSurf(".CONICAL_SURF.");
-static TCollection_AsciiString bssfSphericalSurf(".SPHERICAL_SURF.");
-static TCollection_AsciiString bssfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bssfRuledSurf(".RULED_SURF.");
-static TCollection_AsciiString bssfSurfOfRevolution(".SURF_OF_REVOLUTION.");
-static TCollection_AsciiString bssfCylindricalSurf(".CYLINDRICAL_SURF.");
-static TCollection_AsciiString bssfQuadricSurf(".QUADRIC_SURF.");
+#include "RWStepGeom_RWBSplineSurfaceForm.pxx"
+#include "RWStepGeom_RWKnotType.pxx"
 
 RWStepGeom_RWBSplineSurfaceWithKnots::RWStepGeom_RWBSplineSurfaceWithKnots() {}
 
@@ -112,30 +96,10 @@ void RWStepGeom_RWBSplineSurfaceWithKnots::ReadStep(
   if (data->ParamType(num, 5) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 5);
-    if (bssfSurfOfLinearExtrusion.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfLinearExtrusion;
-    else if (bssfPlaneSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfPlaneSurf;
-    else if (bssfGeneralisedCone.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfGeneralisedCone;
-    else if (bssfToroidalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfToroidalSurf;
-    else if (bssfConicalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfConicalSurf;
-    else if (bssfSphericalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSphericalSurf;
-    else if (bssfUnspecified.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfUnspecified;
-    else if (bssfRuledSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfRuledSurf;
-    else if (bssfSurfOfRevolution.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfRevolution;
-    else if (bssfCylindricalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfCylindricalSurf;
-    else if (bssfQuadricSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfQuadricSurf;
-    else
+    if (!RWStepGeom_RWBSplineSurfaceForm::ConvertToEnum(text, aSurfaceForm))
+    {
       ach->AddFail("Enumeration b_spline_surface_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #5 (surface_form) is not an enumeration");
@@ -232,16 +196,10 @@ void RWStepGeom_RWBSplineSurfaceWithKnots::ReadStep(
   if (data->ParamType(num, 13) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 13);
-    if (ktUniformKnots.IsEqual(text))
-      aKnotSpec = StepGeom_ktUniformKnots;
-    else if (ktQuasiUniformKnots.IsEqual(text))
-      aKnotSpec = StepGeom_ktQuasiUniformKnots;
-    else if (ktPiecewiseBezierKnots.IsEqual(text))
-      aKnotSpec = StepGeom_ktPiecewiseBezierKnots;
-    else if (ktUnspecified.IsEqual(text))
-      aKnotSpec = StepGeom_ktUnspecified;
-    else
+    if (!RWStepGeom_RWKnotType::ConvertToEnum(text, aKnotSpec))
+    {
       ach->AddFail("Enumeration knot_type has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #13 (knot_spec) is not an enumeration");
@@ -298,42 +256,7 @@ void RWStepGeom_RWBSplineSurfaceWithKnots::WriteStep(
 
   // --- inherited field surfaceForm ---
 
-  switch (ent->SurfaceForm())
-  {
-    case StepGeom_bssfSurfOfLinearExtrusion:
-      SW.SendEnum(bssfSurfOfLinearExtrusion);
-      break;
-    case StepGeom_bssfPlaneSurf:
-      SW.SendEnum(bssfPlaneSurf);
-      break;
-    case StepGeom_bssfGeneralisedCone:
-      SW.SendEnum(bssfGeneralisedCone);
-      break;
-    case StepGeom_bssfToroidalSurf:
-      SW.SendEnum(bssfToroidalSurf);
-      break;
-    case StepGeom_bssfConicalSurf:
-      SW.SendEnum(bssfConicalSurf);
-      break;
-    case StepGeom_bssfSphericalSurf:
-      SW.SendEnum(bssfSphericalSurf);
-      break;
-    case StepGeom_bssfUnspecified:
-      SW.SendEnum(bssfUnspecified);
-      break;
-    case StepGeom_bssfRuledSurf:
-      SW.SendEnum(bssfRuledSurf);
-      break;
-    case StepGeom_bssfSurfOfRevolution:
-      SW.SendEnum(bssfSurfOfRevolution);
-      break;
-    case StepGeom_bssfCylindricalSurf:
-      SW.SendEnum(bssfCylindricalSurf);
-      break;
-    case StepGeom_bssfQuadricSurf:
-      SW.SendEnum(bssfQuadricSurf);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineSurfaceForm::ConvertToString(ent->SurfaceForm()));
 
   // --- inherited field uClosed ---
 
@@ -385,21 +308,7 @@ void RWStepGeom_RWBSplineSurfaceWithKnots::WriteStep(
 
   // --- own field : knotSpec ---
 
-  switch (ent->KnotSpec())
-  {
-    case StepGeom_ktUniformKnots:
-      SW.SendEnum(ktUniformKnots);
-      break;
-    case StepGeom_ktQuasiUniformKnots:
-      SW.SendEnum(ktQuasiUniformKnots);
-      break;
-    case StepGeom_ktPiecewiseBezierKnots:
-      SW.SendEnum(ktPiecewiseBezierKnots);
-      break;
-    case StepGeom_ktUnspecified:
-      SW.SendEnum(ktUnspecified);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWKnotType::ConvertToString(ent->KnotSpec()));
 }
 
 void RWStepGeom_RWBSplineSurfaceWithKnots::Share(
index 965ab134c6f7d02ebdb7c702e06bd26e8b71efce..c868c6370fd2c8e926caf5f72df0ab7822ad27e8 100644 (file)
 #include <TColStd_HArray1OfReal.hxx>
 #include <TColStd_HArray2OfReal.hxx>
 
-// --- Enum : BSplineSurfaceForm ---
-static TCollection_AsciiString bssfSurfOfLinearExtrusion(".SURF_OF_LINEAR_EXTRUSION.");
-static TCollection_AsciiString bssfPlaneSurf(".PLANE_SURF.");
-static TCollection_AsciiString bssfGeneralisedCone(".GENERALISED_CONE.");
-static TCollection_AsciiString bssfToroidalSurf(".TOROIDAL_SURF.");
-static TCollection_AsciiString bssfConicalSurf(".CONICAL_SURF.");
-static TCollection_AsciiString bssfSphericalSurf(".SPHERICAL_SURF.");
-static TCollection_AsciiString bssfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bssfRuledSurf(".RULED_SURF.");
-static TCollection_AsciiString bssfSurfOfRevolution(".SURF_OF_REVOLUTION.");
-static TCollection_AsciiString bssfCylindricalSurf(".CYLINDRICAL_SURF.");
-static TCollection_AsciiString bssfQuadricSurf(".QUADRIC_SURF.");
-
-// --- Enum : KnotType ---
-static TCollection_AsciiString ktUniformKnots(".UNIFORM_KNOTS.");
-static TCollection_AsciiString ktQuasiUniformKnots(".QUASI_UNIFORM_KNOTS.");
-static TCollection_AsciiString ktPiecewiseBezierKnots(".PIECEWISE_BEZIER_KNOTS.");
-static TCollection_AsciiString ktUnspecified(".UNSPECIFIED.");
+#include "RWStepGeom_RWBSplineSurfaceForm.pxx"
+#include "RWStepGeom_RWKnotType.pxx"
 
 RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface::
   RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface()
@@ -117,30 +101,10 @@ void RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface::ReadStep(
   if (data->ParamType(num, 4) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 4);
-    if (bssfSurfOfLinearExtrusion.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfLinearExtrusion;
-    else if (bssfPlaneSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfPlaneSurf;
-    else if (bssfGeneralisedCone.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfGeneralisedCone;
-    else if (bssfToroidalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfToroidalSurf;
-    else if (bssfConicalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfConicalSurf;
-    else if (bssfSphericalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSphericalSurf;
-    else if (bssfUnspecified.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfUnspecified;
-    else if (bssfRuledSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfRuledSurf;
-    else if (bssfSurfOfRevolution.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfRevolution;
-    else if (bssfCylindricalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfCylindricalSurf;
-    else if (bssfQuadricSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfQuadricSurf;
-    else
+    if (!RWStepGeom_RWBSplineSurfaceForm::ConvertToEnum(text, aSurfaceForm))
+    {
       ach->AddFail("Enumeration b_spline_surface_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #4 (surface_form) is not an enumeration");
@@ -242,16 +206,10 @@ void RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface::ReadStep(
   if (data->ParamType(num, 5) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 5);
-    if (ktUniformKnots.IsEqual(text))
-      aKnotSpec = StepGeom_ktUniformKnots;
-    else if (ktQuasiUniformKnots.IsEqual(text))
-      aKnotSpec = StepGeom_ktQuasiUniformKnots;
-    else if (ktPiecewiseBezierKnots.IsEqual(text))
-      aKnotSpec = StepGeom_ktPiecewiseBezierKnots;
-    else if (ktUnspecified.IsEqual(text))
-      aKnotSpec = StepGeom_ktUnspecified;
-    else
+    if (!RWStepGeom_RWKnotType::ConvertToEnum(text, aKnotSpec))
+    {
       ach->AddFail("Enumeration knot_type has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #5 (knot_spec) is not an enumeration");
@@ -367,43 +325,7 @@ void RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface::WriteStep(
   }
   SW.CloseSub();
   // --- field : surfaceForm ---
-
-  switch (ent->SurfaceForm())
-  {
-    case StepGeom_bssfSurfOfLinearExtrusion:
-      SW.SendEnum(bssfSurfOfLinearExtrusion);
-      break;
-    case StepGeom_bssfPlaneSurf:
-      SW.SendEnum(bssfPlaneSurf);
-      break;
-    case StepGeom_bssfGeneralisedCone:
-      SW.SendEnum(bssfGeneralisedCone);
-      break;
-    case StepGeom_bssfToroidalSurf:
-      SW.SendEnum(bssfToroidalSurf);
-      break;
-    case StepGeom_bssfConicalSurf:
-      SW.SendEnum(bssfConicalSurf);
-      break;
-    case StepGeom_bssfSphericalSurf:
-      SW.SendEnum(bssfSphericalSurf);
-      break;
-    case StepGeom_bssfUnspecified:
-      SW.SendEnum(bssfUnspecified);
-      break;
-    case StepGeom_bssfRuledSurf:
-      SW.SendEnum(bssfRuledSurf);
-      break;
-    case StepGeom_bssfSurfOfRevolution:
-      SW.SendEnum(bssfSurfOfRevolution);
-      break;
-    case StepGeom_bssfCylindricalSurf:
-      SW.SendEnum(bssfCylindricalSurf);
-      break;
-    case StepGeom_bssfQuadricSurf:
-      SW.SendEnum(bssfQuadricSurf);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineSurfaceForm::ConvertToString(ent->SurfaceForm()));
   // --- field : uClosed ---
 
   SW.SendLogical(ent->UClosed());
@@ -451,21 +373,7 @@ void RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface::WriteStep(
   SW.CloseSub();
   // --- field : knotSpec ---
 
-  switch (ent->KnotSpec())
-  {
-    case StepGeom_ktUniformKnots:
-      SW.SendEnum(ktUniformKnots);
-      break;
-    case StepGeom_ktQuasiUniformKnots:
-      SW.SendEnum(ktQuasiUniformKnots);
-      break;
-    case StepGeom_ktPiecewiseBezierKnots:
-      SW.SendEnum(ktPiecewiseBezierKnots);
-      break;
-    case StepGeom_ktUnspecified:
-      SW.SendEnum(ktUnspecified);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWKnotType::ConvertToString(ent->KnotSpec()));
 
   // --- Instance of plex component GeometricRepresentationItem ---
 
index 77a7a03287d81a1b4de261fbd001a2ce6da558be..1034182736326a17a71382d31f4b0bb317666e29 100644 (file)
 #include <StepGeom_CartesianPoint.hxx>
 #include <StepGeom_HArray1OfCartesianPoint.hxx>
 
-// --- Enum : BSplineCurveForm ---
-static TCollection_AsciiString bscfEllipticArc(".ELLIPTIC_ARC.");
-static TCollection_AsciiString bscfPolylineForm(".POLYLINE_FORM.");
-static TCollection_AsciiString bscfParabolicArc(".PARABOLIC_ARC.");
-static TCollection_AsciiString bscfCircularArc(".CIRCULAR_ARC.");
-static TCollection_AsciiString bscfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bscfHyperbolicArc(".HYPERBOLIC_ARC.");
+#include "RWStepGeom_RWBSplineCurveForm.pxx"
 
 RWStepGeom_RWBezierCurve::RWStepGeom_RWBezierCurve() {}
 
@@ -82,20 +76,10 @@ void RWStepGeom_RWBezierCurve::ReadStep(const Handle(StepData_StepReaderData)& d
   if (data->ParamType(num, 4) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 4);
-    if (bscfEllipticArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfEllipticArc;
-    else if (bscfPolylineForm.IsEqual(text))
-      aCurveForm = StepGeom_bscfPolylineForm;
-    else if (bscfParabolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfParabolicArc;
-    else if (bscfCircularArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfCircularArc;
-    else if (bscfUnspecified.IsEqual(text))
-      aCurveForm = StepGeom_bscfUnspecified;
-    else if (bscfHyperbolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfHyperbolicArc;
-    else
+    if (!RWStepGeom_RWBSplineCurveForm::ConvertToEnum(text, aCurveForm))
+    {
       ach->AddFail("Enumeration b_spline_curve_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #4 (curve_form) is not an enumeration");
@@ -140,27 +124,7 @@ void RWStepGeom_RWBezierCurve::WriteStep(StepData_StepWriter&                SW,
 
   // --- inherited field curveForm ---
 
-  switch (ent->CurveForm())
-  {
-    case StepGeom_bscfEllipticArc:
-      SW.SendEnum(bscfEllipticArc);
-      break;
-    case StepGeom_bscfPolylineForm:
-      SW.SendEnum(bscfPolylineForm);
-      break;
-    case StepGeom_bscfParabolicArc:
-      SW.SendEnum(bscfParabolicArc);
-      break;
-    case StepGeom_bscfCircularArc:
-      SW.SendEnum(bscfCircularArc);
-      break;
-    case StepGeom_bscfUnspecified:
-      SW.SendEnum(bscfUnspecified);
-      break;
-    case StepGeom_bscfHyperbolicArc:
-      SW.SendEnum(bscfHyperbolicArc);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineCurveForm::ConvertToString(ent->CurveForm()));
 
   // --- inherited field closedCurve ---
 
index c109cff41731451264f68c9440a4db5891aa260d..08eee7458e0be638ab8939cb7f87dffb64543769 100644 (file)
 #include <StepGeom_HArray1OfCartesianPoint.hxx>
 #include <TColStd_HArray1OfReal.hxx>
 
-// --- Enum : BSplineCurveForm ---
-static TCollection_AsciiString bscfEllipticArc(".ELLIPTIC_ARC.");
-static TCollection_AsciiString bscfPolylineForm(".POLYLINE_FORM.");
-static TCollection_AsciiString bscfParabolicArc(".PARABOLIC_ARC.");
-static TCollection_AsciiString bscfCircularArc(".CIRCULAR_ARC.");
-static TCollection_AsciiString bscfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bscfHyperbolicArc(".HYPERBOLIC_ARC.");
+#include "RWStepGeom_RWBSplineCurveForm.pxx"
 
 RWStepGeom_RWBezierCurveAndRationalBSplineCurve::RWStepGeom_RWBezierCurveAndRationalBSplineCurve()
 {
@@ -94,20 +88,10 @@ void RWStepGeom_RWBezierCurveAndRationalBSplineCurve::ReadStep(
   if (data->ParamType(num, 3) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 3);
-    if (bscfEllipticArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfEllipticArc;
-    else if (bscfPolylineForm.IsEqual(text))
-      aCurveForm = StepGeom_bscfPolylineForm;
-    else if (bscfParabolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfParabolicArc;
-    else if (bscfCircularArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfCircularArc;
-    else if (bscfUnspecified.IsEqual(text))
-      aCurveForm = StepGeom_bscfUnspecified;
-    else if (bscfHyperbolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfHyperbolicArc;
-    else
+    if (!RWStepGeom_RWBSplineCurveForm::ConvertToEnum(text, aCurveForm))
+    {
       ach->AddFail("Enumeration b_spline_curve_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #3 (curve_form) is not an enumeration");
@@ -212,28 +196,7 @@ void RWStepGeom_RWBezierCurveAndRationalBSplineCurve::WriteStep(
   }
   SW.CloseSub();
   // --- field : curveForm ---
-
-  switch (ent->CurveForm())
-  {
-    case StepGeom_bscfEllipticArc:
-      SW.SendEnum(bscfEllipticArc);
-      break;
-    case StepGeom_bscfPolylineForm:
-      SW.SendEnum(bscfPolylineForm);
-      break;
-    case StepGeom_bscfParabolicArc:
-      SW.SendEnum(bscfParabolicArc);
-      break;
-    case StepGeom_bscfCircularArc:
-      SW.SendEnum(bscfCircularArc);
-      break;
-    case StepGeom_bscfUnspecified:
-      SW.SendEnum(bscfUnspecified);
-      break;
-    case StepGeom_bscfHyperbolicArc:
-      SW.SendEnum(bscfHyperbolicArc);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineCurveForm::ConvertToString(ent->CurveForm()));
   // --- field : closedCurve ---
 
   SW.SendLogical(ent->ClosedCurve());
index fa0c8a106003be19289aa464636673f490565f4e..b34d2786308c5fb2ae282414f8db8e11b5b178e1 100644 (file)
 #include <StepGeom_CartesianPoint.hxx>
 #include <StepGeom_HArray2OfCartesianPoint.hxx>
 
-// --- Enum : BSplineSurfaceForm ---
-static TCollection_AsciiString bssfSurfOfLinearExtrusion(".SURF_OF_LINEAR_EXTRUSION.");
-static TCollection_AsciiString bssfPlaneSurf(".PLANE_SURF.");
-static TCollection_AsciiString bssfGeneralisedCone(".GENERALISED_CONE.");
-static TCollection_AsciiString bssfToroidalSurf(".TOROIDAL_SURF.");
-static TCollection_AsciiString bssfConicalSurf(".CONICAL_SURF.");
-static TCollection_AsciiString bssfSphericalSurf(".SPHERICAL_SURF.");
-static TCollection_AsciiString bssfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bssfRuledSurf(".RULED_SURF.");
-static TCollection_AsciiString bssfSurfOfRevolution(".SURF_OF_REVOLUTION.");
-static TCollection_AsciiString bssfCylindricalSurf(".CYLINDRICAL_SURF.");
-static TCollection_AsciiString bssfQuadricSurf(".QUADRIC_SURF.");
+#include "RWStepGeom_RWBSplineSurfaceForm.pxx"
 
 RWStepGeom_RWBezierSurface::RWStepGeom_RWBezierSurface() {}
 
@@ -101,30 +90,11 @@ void RWStepGeom_RWBezierSurface::ReadStep(const Handle(StepData_StepReaderData)&
   if (data->ParamType(num, 5) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 5);
-    if (bssfSurfOfLinearExtrusion.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfLinearExtrusion;
-    else if (bssfPlaneSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfPlaneSurf;
-    else if (bssfGeneralisedCone.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfGeneralisedCone;
-    else if (bssfToroidalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfToroidalSurf;
-    else if (bssfConicalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfConicalSurf;
-    else if (bssfSphericalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSphericalSurf;
-    else if (bssfUnspecified.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfUnspecified;
-    else if (bssfRuledSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfRuledSurf;
-    else if (bssfSurfOfRevolution.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfRevolution;
-    else if (bssfCylindricalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfCylindricalSurf;
-    else if (bssfQuadricSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfQuadricSurf;
-    else
+
+    if (!RWStepGeom_RWBSplineSurfaceForm::ConvertToEnum(text, aSurfaceForm))
+    {
       ach->AddFail("Enumeration b_spline_surface_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #5 (surface_form) is not an enumeration");
@@ -193,42 +163,7 @@ void RWStepGeom_RWBezierSurface::WriteStep(StepData_StepWriter&
 
   // --- inherited field surfaceForm ---
 
-  switch (ent->SurfaceForm())
-  {
-    case StepGeom_bssfSurfOfLinearExtrusion:
-      SW.SendEnum(bssfSurfOfLinearExtrusion);
-      break;
-    case StepGeom_bssfPlaneSurf:
-      SW.SendEnum(bssfPlaneSurf);
-      break;
-    case StepGeom_bssfGeneralisedCone:
-      SW.SendEnum(bssfGeneralisedCone);
-      break;
-    case StepGeom_bssfToroidalSurf:
-      SW.SendEnum(bssfToroidalSurf);
-      break;
-    case StepGeom_bssfConicalSurf:
-      SW.SendEnum(bssfConicalSurf);
-      break;
-    case StepGeom_bssfSphericalSurf:
-      SW.SendEnum(bssfSphericalSurf);
-      break;
-    case StepGeom_bssfUnspecified:
-      SW.SendEnum(bssfUnspecified);
-      break;
-    case StepGeom_bssfRuledSurf:
-      SW.SendEnum(bssfRuledSurf);
-      break;
-    case StepGeom_bssfSurfOfRevolution:
-      SW.SendEnum(bssfSurfOfRevolution);
-      break;
-    case StepGeom_bssfCylindricalSurf:
-      SW.SendEnum(bssfCylindricalSurf);
-      break;
-    case StepGeom_bssfQuadricSurf:
-      SW.SendEnum(bssfQuadricSurf);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineSurfaceForm::ConvertToString(ent->SurfaceForm()));
 
   // --- inherited field uClosed ---
 
index 0c1682fd71f2367fe6eef1834f34e6bebe818af4..0b800a8df39614aaace12f35e73ac536095f96e3 100644 (file)
 #include <StepGeom_HArray2OfCartesianPoint.hxx>
 #include <TColStd_HArray2OfReal.hxx>
 
-// --- Enum : BSplineSurfaceForm ---
-static TCollection_AsciiString bssfSurfOfLinearExtrusion(".SURF_OF_LINEAR_EXTRUSION.");
-static TCollection_AsciiString bssfPlaneSurf(".PLANE_SURF.");
-static TCollection_AsciiString bssfGeneralisedCone(".GENERALISED_CONE.");
-static TCollection_AsciiString bssfToroidalSurf(".TOROIDAL_SURF.");
-static TCollection_AsciiString bssfConicalSurf(".CONICAL_SURF.");
-static TCollection_AsciiString bssfSphericalSurf(".SPHERICAL_SURF.");
-static TCollection_AsciiString bssfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bssfRuledSurf(".RULED_SURF.");
-static TCollection_AsciiString bssfSurfOfRevolution(".SURF_OF_REVOLUTION.");
-static TCollection_AsciiString bssfCylindricalSurf(".CYLINDRICAL_SURF.");
-static TCollection_AsciiString bssfQuadricSurf(".QUADRIC_SURF.");
+#include "RWStepGeom_RWBSplineSurfaceForm.pxx"
 
 RWStepGeom_RWBezierSurfaceAndRationalBSplineSurface::
   RWStepGeom_RWBezierSurfaceAndRationalBSplineSurface()
@@ -113,30 +102,10 @@ void RWStepGeom_RWBezierSurfaceAndRationalBSplineSurface::ReadStep(
   if (data->ParamType(num, 4) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 4);
-    if (bssfSurfOfLinearExtrusion.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfLinearExtrusion;
-    else if (bssfPlaneSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfPlaneSurf;
-    else if (bssfGeneralisedCone.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfGeneralisedCone;
-    else if (bssfToroidalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfToroidalSurf;
-    else if (bssfConicalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfConicalSurf;
-    else if (bssfSphericalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSphericalSurf;
-    else if (bssfUnspecified.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfUnspecified;
-    else if (bssfRuledSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfRuledSurf;
-    else if (bssfSurfOfRevolution.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfRevolution;
-    else if (bssfCylindricalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfCylindricalSurf;
-    else if (bssfQuadricSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfQuadricSurf;
-    else
+    if (!RWStepGeom_RWBSplineSurfaceForm::ConvertToEnum(text, aSurfaceForm))
+    {
       ach->AddFail("Enumeration b_spline_surface_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #4 (surface_form) is not an enumeration");
@@ -267,42 +236,8 @@ void RWStepGeom_RWBezierSurfaceAndRationalBSplineSurface::WriteStep(
   SW.CloseSub();
   // --- field : surfaceForm ---
 
-  switch (ent->SurfaceForm())
-  {
-    case StepGeom_bssfSurfOfLinearExtrusion:
-      SW.SendEnum(bssfSurfOfLinearExtrusion);
-      break;
-    case StepGeom_bssfPlaneSurf:
-      SW.SendEnum(bssfPlaneSurf);
-      break;
-    case StepGeom_bssfGeneralisedCone:
-      SW.SendEnum(bssfGeneralisedCone);
-      break;
-    case StepGeom_bssfToroidalSurf:
-      SW.SendEnum(bssfToroidalSurf);
-      break;
-    case StepGeom_bssfConicalSurf:
-      SW.SendEnum(bssfConicalSurf);
-      break;
-    case StepGeom_bssfSphericalSurf:
-      SW.SendEnum(bssfSphericalSurf);
-      break;
-    case StepGeom_bssfUnspecified:
-      SW.SendEnum(bssfUnspecified);
-      break;
-    case StepGeom_bssfRuledSurf:
-      SW.SendEnum(bssfRuledSurf);
-      break;
-    case StepGeom_bssfSurfOfRevolution:
-      SW.SendEnum(bssfSurfOfRevolution);
-      break;
-    case StepGeom_bssfCylindricalSurf:
-      SW.SendEnum(bssfCylindricalSurf);
-      break;
-    case StepGeom_bssfQuadricSurf:
-      SW.SendEnum(bssfQuadricSurf);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineSurfaceForm::ConvertToString(ent->SurfaceForm()));
+
   // --- field : uClosed ---
 
   SW.SendLogical(ent->UClosed());
index c9dbf261135177539858345eb4577739b336d8a4..99923274ac4b26b6b2843034331c866844355e11 100644 (file)
 #include <StepGeom_TransitionCode.hxx>
 #include <TCollection_AsciiString.hxx>
 
-// --- Enum : TransitionCode ---
-static TCollection_AsciiString tcDiscontinuous(".DISCONTINUOUS.");
-static TCollection_AsciiString tcContSameGradientSameCurvature(
-  ".CONT_SAME_GRADIENT_SAME_CURVATURE.");
-static TCollection_AsciiString tcContSameGradient(".CONT_SAME_GRADIENT.");
-static TCollection_AsciiString tcContinuous(".CONTINUOUS.");
+#include "RWStepGeom_RWTransitionCode.pxx"
 
 RWStepGeom_RWCompositeCurveSegment::RWStepGeom_RWCompositeCurveSegment() {}
 
@@ -47,16 +42,10 @@ void RWStepGeom_RWCompositeCurveSegment::ReadStep(
   if (data->ParamType(num, 1) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 1);
-    if (tcDiscontinuous.IsEqual(text))
-      aTransition = StepGeom_tcDiscontinuous;
-    else if (tcContSameGradientSameCurvature.IsEqual(text))
-      aTransition = StepGeom_tcContSameGradientSameCurvature;
-    else if (tcContSameGradient.IsEqual(text))
-      aTransition = StepGeom_tcContSameGradient;
-    else if (tcContinuous.IsEqual(text))
-      aTransition = StepGeom_tcContinuous;
-    else
+    if (!RWStepGeom_RWTransitionCode::ConvertToEnum(text, aTransition))
+    {
       ach->AddFail("Enumeration transition_code has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #1 (transition) is not an enumeration");
@@ -85,21 +74,7 @@ void RWStepGeom_RWCompositeCurveSegment::WriteStep(
 
   // --- own field : transition ---
 
-  switch (ent->Transition())
-  {
-    case StepGeom_tcDiscontinuous:
-      SW.SendEnum(tcDiscontinuous);
-      break;
-    case StepGeom_tcContSameGradientSameCurvature:
-      SW.SendEnum(tcContSameGradientSameCurvature);
-      break;
-    case StepGeom_tcContSameGradient:
-      SW.SendEnum(tcContSameGradient);
-      break;
-    case StepGeom_tcContinuous:
-      SW.SendEnum(tcContinuous);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWTransitionCode::ConvertToString(ent->Transition()));
 
   // --- own field : sameSense ---
 
index e2e9a13e7f55a8825495665b9835c312e8ce4db0..92d79658761f7bf45fb259539531a94044737498 100644 (file)
 #include <StepGeom_PcurveOrSurface.hxx>
 #include <StepGeom_PreferredSurfaceCurveRepresentation.hxx>
 
-// --- Enum : PreferredSurfaceCurveRepresentation ---
-static TCollection_AsciiString pscrPcurveS2(".PCURVE_S2.");
-static TCollection_AsciiString pscrPcurveS1(".PCURVE_S1.");
-static TCollection_AsciiString pscrCurve3d(".CURVE_3D.");
+#include "RWStepGeom_RWPreferredSurfaceCurveRepresentation.pxx"
 
 RWStepGeom_RWIntersectionCurve::RWStepGeom_RWIntersectionCurve() {}
 
@@ -73,14 +70,11 @@ void RWStepGeom_RWIntersectionCurve::ReadStep(const Handle(StepData_StepReaderDa
   if (data->ParamType(num, 4) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 4);
-    if (pscrPcurveS2.IsEqual(text))
-      aMasterRepresentation = StepGeom_pscrPcurveS2;
-    else if (pscrPcurveS1.IsEqual(text))
-      aMasterRepresentation = StepGeom_pscrPcurveS1;
-    else if (pscrCurve3d.IsEqual(text))
-      aMasterRepresentation = StepGeom_pscrCurve3d;
-    else
+    if (!RWStepGeom_RWPreferredSurfaceCurveRepresentation::ConvertToEnum(text,
+                                                                         aMasterRepresentation))
+    {
       ach->AddFail("Enumeration preferred_surface_curve_representation has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #4 (master_representation) is not an enumeration");
@@ -113,18 +107,8 @@ void RWStepGeom_RWIntersectionCurve::WriteStep(StepData_StepWriter&
 
   // --- inherited field masterRepresentation ---
 
-  switch (ent->MasterRepresentation())
-  {
-    case StepGeom_pscrPcurveS2:
-      SW.SendEnum(pscrPcurveS2);
-      break;
-    case StepGeom_pscrPcurveS1:
-      SW.SendEnum(pscrPcurveS1);
-      break;
-    case StepGeom_pscrCurve3d:
-      SW.SendEnum(pscrCurve3d);
-      break;
-  }
+  SW.SendEnum(
+    RWStepGeom_RWPreferredSurfaceCurveRepresentation::ConvertToString(ent->MasterRepresentation()));
 }
 
 void RWStepGeom_RWIntersectionCurve::Share(const Handle(StepGeom_IntersectionCurve)& ent,
diff --git a/src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWKnotType.pxx b/src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWKnotType.pxx
new file mode 100644 (file)
index 0000000..0292aa6
--- /dev/null
@@ -0,0 +1,78 @@
+// Copyright (c) 2025 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 _RWStepGeom_RWKnotType_HeaderFile
+#define _RWStepGeom_RWKnotType_HeaderFile
+
+#include <StepGeom_KnotType.hxx>
+#include <Standard_CString.hxx>
+
+namespace RWStepGeom_RWKnotType
+{
+
+static constexpr char ktUniformKnots[]         = (".UNIFORM_KNOTS.");
+static constexpr char ktQuasiUniformKnots[]    = (".QUASI_UNIFORM_KNOTS.");
+static constexpr char ktPiecewiseBezierKnots[] = (".PIECEWISE_BEZIER_KNOTS.");
+static constexpr char ktUnspecified[]          = (".UNSPECIFIED.");
+
+//! Convert StepGeom_KnotType to string
+//! @param theSourceEnum The StepGeom_KnotType value to convert
+//! @return The corresponding string representation or nullptr if not found
+inline const char* ConvertToString(const StepGeom_KnotType theSourceEnum)
+{
+  switch (theSourceEnum)
+  {
+    case StepGeom_ktUniformKnots:
+      return ktUniformKnots;
+    case StepGeom_ktQuasiUniformKnots:
+      return ktQuasiUniformKnots;
+    case StepGeom_ktPiecewiseBezierKnots:
+      return ktPiecewiseBezierKnots;
+    case StepGeom_ktUnspecified:
+      return ktUnspecified;
+  }
+  return nullptr;
+}
+
+//! Convert string to StepGeom_KnotType
+//! @param theKnotTypeString The string to convert
+//! @param theResultEnum The corresponding StepGeom_KnotType value
+//! @return Standard_True if the conversion was successful, Standard_False otherwise
+inline bool ConvertToEnum(const Standard_CString theKnotTypeString,
+                          StepGeom_KnotType&     theResultEnum)
+{
+  if (IsEqual(theKnotTypeString, ktUniformKnots))
+  {
+    theResultEnum = StepGeom_ktUniformKnots;
+  }
+  else if (IsEqual(theKnotTypeString, ktQuasiUniformKnots))
+  {
+    theResultEnum = StepGeom_ktQuasiUniformKnots;
+  }
+  else if (IsEqual(theKnotTypeString, ktPiecewiseBezierKnots))
+  {
+    theResultEnum = StepGeom_ktPiecewiseBezierKnots;
+  }
+  else if (IsEqual(theKnotTypeString, ktUnspecified))
+  {
+    theResultEnum = StepGeom_ktUnspecified;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+} // namespace RWStepGeom_RWKnotType
+
+#endif // _RWStepGeom_RWKnotType_HeaderFile
diff --git a/src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWPreferredSurfaceCurveRepresentation.pxx b/src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWPreferredSurfaceCurveRepresentation.pxx
new file mode 100644 (file)
index 0000000..127991e
--- /dev/null
@@ -0,0 +1,70 @@
+// Copyright (c) 2025 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 _RWStepGeom_RWPreferredSurfaceCurveRepresentation_HeaderFile
+#define _RWStepGeom_RWPreferredSurfaceCurveRepresentation_HeaderFile
+
+#include <StepGeom_PreferredSurfaceCurveRepresentation.hxx>
+#include <Standard_CString.hxx>
+
+namespace RWStepGeom_RWPreferredSurfaceCurveRepresentation
+{
+static constexpr char pscrPcurveS2[] = ".PCURVE_S2.";
+static constexpr char pscrPcurveS1[] = ".PCURVE_S1.";
+static constexpr char pscrCurve3d[]  = ".CURVE_3D.";
+
+//! Convert StepGeom_PreferredSurfaceCurveRepresentation to string
+//! @param theSourceEnum The StepGeom_PreferredSurfaceCurveRepresentation value to convert
+//! @return The corresponding string representation or nullptr if not found
+inline const char* ConvertToString(const StepGeom_PreferredSurfaceCurveRepresentation theSourceEnum)
+{
+  switch (theSourceEnum)
+  {
+    case StepGeom_pscrPcurveS2:
+      return pscrPcurveS2;
+    case StepGeom_pscrPcurveS1:
+      return pscrPcurveS1;
+    case StepGeom_pscrCurve3d:
+      return pscrCurve3d;
+  }
+  return nullptr;
+}
+
+//! Convert string to StepGeom_PreferredSurfaceCurveRepresentation
+//! @param theRepresentationStr The string to convert
+//! @param theResultEnum The corresponding StepGeom_PreferredSurfaceCurveRepresentation value
+//! @return Standard_True if the conversion was successful, Standard_False otherwise
+inline bool ConvertToEnum(const Standard_CString                        theRepresentationStr,
+                          StepGeom_PreferredSurfaceCurveRepresentation& theResultEnum)
+{
+  if (IsEqual(theRepresentationStr, pscrPcurveS2))
+  {
+    theResultEnum = StepGeom_pscrPcurveS2;
+  }
+  else if (IsEqual(theRepresentationStr, pscrPcurveS1))
+  {
+    theResultEnum = StepGeom_pscrPcurveS1;
+  }
+  else if (IsEqual(theRepresentationStr, pscrCurve3d))
+  {
+    theResultEnum = StepGeom_pscrCurve3d;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+} // namespace RWStepGeom_RWPreferredSurfaceCurveRepresentation
+
+#endif // _RWStepGeom_RWPreferredSurfaceCurveRepresentation_HeaderFile
index e6f3b56f55b065218b9ef67d0fe0a8998785fdfa..f681f6d5c0e2ba0ddc9d373e071bf7da93a681e9 100644 (file)
 #include <StepData_StepWriter.hxx>
 #include <StepGeom_QuasiUniformCurve.hxx>
 
-// --- Enum : BSplineCurveForm ---
-static TCollection_AsciiString bscfEllipticArc(".ELLIPTIC_ARC.");
-static TCollection_AsciiString bscfPolylineForm(".POLYLINE_FORM.");
-static TCollection_AsciiString bscfParabolicArc(".PARABOLIC_ARC.");
-static TCollection_AsciiString bscfCircularArc(".CIRCULAR_ARC.");
-static TCollection_AsciiString bscfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bscfHyperbolicArc(".HYPERBOLIC_ARC.");
+#include "RWStepGeom_RWBSplineCurveForm.pxx"
 
 RWStepGeom_RWQuasiUniformCurve::RWStepGeom_RWQuasiUniformCurve() {}
 
@@ -79,20 +73,10 @@ void RWStepGeom_RWQuasiUniformCurve::ReadStep(const Handle(StepData_StepReaderDa
   if (data->ParamType(num, 4) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 4);
-    if (bscfEllipticArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfEllipticArc;
-    else if (bscfPolylineForm.IsEqual(text))
-      aCurveForm = StepGeom_bscfPolylineForm;
-    else if (bscfParabolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfParabolicArc;
-    else if (bscfCircularArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfCircularArc;
-    else if (bscfUnspecified.IsEqual(text))
-      aCurveForm = StepGeom_bscfUnspecified;
-    else if (bscfHyperbolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfHyperbolicArc;
-    else
+    if (!RWStepGeom_RWBSplineCurveForm::ConvertToEnum(text, aCurveForm))
+    {
       ach->AddFail("Enumeration b_spline_curve_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #4 (curve_form) is not an enumeration");
@@ -137,27 +121,7 @@ void RWStepGeom_RWQuasiUniformCurve::WriteStep(StepData_StepWriter&
 
   // --- inherited field curveForm ---
 
-  switch (ent->CurveForm())
-  {
-    case StepGeom_bscfEllipticArc:
-      SW.SendEnum(bscfEllipticArc);
-      break;
-    case StepGeom_bscfPolylineForm:
-      SW.SendEnum(bscfPolylineForm);
-      break;
-    case StepGeom_bscfParabolicArc:
-      SW.SendEnum(bscfParabolicArc);
-      break;
-    case StepGeom_bscfCircularArc:
-      SW.SendEnum(bscfCircularArc);
-      break;
-    case StepGeom_bscfUnspecified:
-      SW.SendEnum(bscfUnspecified);
-      break;
-    case StepGeom_bscfHyperbolicArc:
-      SW.SendEnum(bscfHyperbolicArc);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineCurveForm::ConvertToString(ent->CurveForm()));
 
   // --- inherited field closedCurve ---
 
index cdd106cbf54cd2240194a6cdd8a9c194f160db6c..5b7c904f41f2d569058b12e7e585125ad20e78ed 100644 (file)
 #include <StepGeom_QuasiUniformCurveAndRationalBSplineCurve.hxx>
 #include <TColStd_HArray1OfReal.hxx>
 
-// --- Enum : BSplineCurveForm ---
-static TCollection_AsciiString bscfEllipticArc(".ELLIPTIC_ARC.");
-static TCollection_AsciiString bscfPolylineForm(".POLYLINE_FORM.");
-static TCollection_AsciiString bscfParabolicArc(".PARABOLIC_ARC.");
-static TCollection_AsciiString bscfCircularArc(".CIRCULAR_ARC.");
-static TCollection_AsciiString bscfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bscfHyperbolicArc(".HYPERBOLIC_ARC.");
+#include "RWStepGeom_RWBSplineCurveForm.pxx"
 
 RWStepGeom_RWQuasiUniformCurveAndRationalBSplineCurve::
   RWStepGeom_RWQuasiUniformCurveAndRationalBSplineCurve()
@@ -85,20 +79,10 @@ void RWStepGeom_RWQuasiUniformCurveAndRationalBSplineCurve::ReadStep(
   if (data->ParamType(num, 3) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 3);
-    if (bscfEllipticArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfEllipticArc;
-    else if (bscfPolylineForm.IsEqual(text))
-      aCurveForm = StepGeom_bscfPolylineForm;
-    else if (bscfParabolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfParabolicArc;
-    else if (bscfCircularArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfCircularArc;
-    else if (bscfUnspecified.IsEqual(text))
-      aCurveForm = StepGeom_bscfUnspecified;
-    else if (bscfHyperbolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfHyperbolicArc;
-    else
+    if (!RWStepGeom_RWBSplineCurveForm::ConvertToEnum(text, aCurveForm))
+    {
       ach->AddFail("Enumeration b_spline_curve_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #3 (curve_form) is not an enumeration");
@@ -207,27 +191,7 @@ void RWStepGeom_RWQuasiUniformCurveAndRationalBSplineCurve::WriteStep(
   SW.CloseSub();
   // --- field : curveForm ---
 
-  switch (ent->CurveForm())
-  {
-    case StepGeom_bscfEllipticArc:
-      SW.SendEnum(bscfEllipticArc);
-      break;
-    case StepGeom_bscfPolylineForm:
-      SW.SendEnum(bscfPolylineForm);
-      break;
-    case StepGeom_bscfParabolicArc:
-      SW.SendEnum(bscfParabolicArc);
-      break;
-    case StepGeom_bscfCircularArc:
-      SW.SendEnum(bscfCircularArc);
-      break;
-    case StepGeom_bscfUnspecified:
-      SW.SendEnum(bscfUnspecified);
-      break;
-    case StepGeom_bscfHyperbolicArc:
-      SW.SendEnum(bscfHyperbolicArc);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineCurveForm::ConvertToString(ent->CurveForm()));
   // --- field : closedCurve ---
 
   SW.SendLogical(ent->ClosedCurve());
index f0320801b935a48c496d61ca515d753a0a1aa229..81f5f3acf22c65b97251e76f6790af4b240ddf0a 100644 (file)
 #include <StepData_StepWriter.hxx>
 #include <StepGeom_QuasiUniformSurface.hxx>
 
-// --- Enum : BSplineSurfaceForm ---
-static TCollection_AsciiString bssfSurfOfLinearExtrusion(".SURF_OF_LINEAR_EXTRUSION.");
-static TCollection_AsciiString bssfPlaneSurf(".PLANE_SURF.");
-static TCollection_AsciiString bssfGeneralisedCone(".GENERALISED_CONE.");
-static TCollection_AsciiString bssfToroidalSurf(".TOROIDAL_SURF.");
-static TCollection_AsciiString bssfConicalSurf(".CONICAL_SURF.");
-static TCollection_AsciiString bssfSphericalSurf(".SPHERICAL_SURF.");
-static TCollection_AsciiString bssfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bssfRuledSurf(".RULED_SURF.");
-static TCollection_AsciiString bssfSurfOfRevolution(".SURF_OF_REVOLUTION.");
-static TCollection_AsciiString bssfCylindricalSurf(".CYLINDRICAL_SURF.");
-static TCollection_AsciiString bssfQuadricSurf(".QUADRIC_SURF.");
+#include "RWStepGeom_RWBSplineSurfaceForm.pxx"
 
 RWStepGeom_RWQuasiUniformSurface::RWStepGeom_RWQuasiUniformSurface() {}
 
@@ -99,30 +88,10 @@ void RWStepGeom_RWQuasiUniformSurface::ReadStep(
   if (data->ParamType(num, 5) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 5);
-    if (bssfSurfOfLinearExtrusion.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfLinearExtrusion;
-    else if (bssfPlaneSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfPlaneSurf;
-    else if (bssfGeneralisedCone.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfGeneralisedCone;
-    else if (bssfToroidalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfToroidalSurf;
-    else if (bssfConicalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfConicalSurf;
-    else if (bssfSphericalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSphericalSurf;
-    else if (bssfUnspecified.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfUnspecified;
-    else if (bssfRuledSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfRuledSurf;
-    else if (bssfSurfOfRevolution.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfRevolution;
-    else if (bssfCylindricalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfCylindricalSurf;
-    else if (bssfQuadricSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfQuadricSurf;
-    else
+    if (!RWStepGeom_RWBSplineSurfaceForm::ConvertToEnum(text, aSurfaceForm))
+    {
       ach->AddFail("Enumeration b_spline_surface_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #5 (surface_form) is not an enumeration");
@@ -192,42 +161,7 @@ void RWStepGeom_RWQuasiUniformSurface::WriteStep(
 
   // --- inherited field surfaceForm ---
 
-  switch (ent->SurfaceForm())
-  {
-    case StepGeom_bssfSurfOfLinearExtrusion:
-      SW.SendEnum(bssfSurfOfLinearExtrusion);
-      break;
-    case StepGeom_bssfPlaneSurf:
-      SW.SendEnum(bssfPlaneSurf);
-      break;
-    case StepGeom_bssfGeneralisedCone:
-      SW.SendEnum(bssfGeneralisedCone);
-      break;
-    case StepGeom_bssfToroidalSurf:
-      SW.SendEnum(bssfToroidalSurf);
-      break;
-    case StepGeom_bssfConicalSurf:
-      SW.SendEnum(bssfConicalSurf);
-      break;
-    case StepGeom_bssfSphericalSurf:
-      SW.SendEnum(bssfSphericalSurf);
-      break;
-    case StepGeom_bssfUnspecified:
-      SW.SendEnum(bssfUnspecified);
-      break;
-    case StepGeom_bssfRuledSurf:
-      SW.SendEnum(bssfRuledSurf);
-      break;
-    case StepGeom_bssfSurfOfRevolution:
-      SW.SendEnum(bssfSurfOfRevolution);
-      break;
-    case StepGeom_bssfCylindricalSurf:
-      SW.SendEnum(bssfCylindricalSurf);
-      break;
-    case StepGeom_bssfQuadricSurf:
-      SW.SendEnum(bssfQuadricSurf);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineSurfaceForm::ConvertToString(ent->SurfaceForm()));
 
   // --- inherited field uClosed ---
 
index 4448fe383013a9b5c2c9535ef74119b7555bc81f..c03ef056a058a10245e0a835100b330dce79bbbd 100644 (file)
 #include <StepGeom_QuasiUniformSurfaceAndRationalBSplineSurface.hxx>
 #include <TColStd_HArray2OfReal.hxx>
 
-// --- Enum : BSplineSurfaceForm ---
-static TCollection_AsciiString bssfSurfOfLinearExtrusion(".SURF_OF_LINEAR_EXTRUSION.");
-static TCollection_AsciiString bssfPlaneSurf(".PLANE_SURF.");
-static TCollection_AsciiString bssfGeneralisedCone(".GENERALISED_CONE.");
-static TCollection_AsciiString bssfToroidalSurf(".TOROIDAL_SURF.");
-static TCollection_AsciiString bssfConicalSurf(".CONICAL_SURF.");
-static TCollection_AsciiString bssfSphericalSurf(".SPHERICAL_SURF.");
-static TCollection_AsciiString bssfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bssfRuledSurf(".RULED_SURF.");
-static TCollection_AsciiString bssfSurfOfRevolution(".SURF_OF_REVOLUTION.");
-static TCollection_AsciiString bssfCylindricalSurf(".CYLINDRICAL_SURF.");
-static TCollection_AsciiString bssfQuadricSurf(".QUADRIC_SURF.");
+#include "RWStepGeom_RWBSplineSurfaceForm.pxx"
 
 RWStepGeom_RWQuasiUniformSurfaceAndRationalBSplineSurface::
   RWStepGeom_RWQuasiUniformSurfaceAndRationalBSplineSurface()
@@ -103,30 +92,10 @@ void RWStepGeom_RWQuasiUniformSurfaceAndRationalBSplineSurface::ReadStep(
   if (data->ParamType(num, 4) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 4);
-    if (bssfSurfOfLinearExtrusion.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfLinearExtrusion;
-    else if (bssfPlaneSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfPlaneSurf;
-    else if (bssfGeneralisedCone.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfGeneralisedCone;
-    else if (bssfToroidalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfToroidalSurf;
-    else if (bssfConicalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfConicalSurf;
-    else if (bssfSphericalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSphericalSurf;
-    else if (bssfUnspecified.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfUnspecified;
-    else if (bssfRuledSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfRuledSurf;
-    else if (bssfSurfOfRevolution.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfRevolution;
-    else if (bssfCylindricalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfCylindricalSurf;
-    else if (bssfQuadricSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfQuadricSurf;
-    else
+    if (!RWStepGeom_RWBSplineSurfaceForm::ConvertToEnum(text, aSurfaceForm))
+    {
       ach->AddFail("Enumeration b_spline_surface_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #4 (surface_form) is not an enumeration");
@@ -260,42 +229,8 @@ void RWStepGeom_RWQuasiUniformSurfaceAndRationalBSplineSurface::WriteStep(
   SW.CloseSub();
   // --- field : surfaceForm ---
 
-  switch (ent->SurfaceForm())
-  {
-    case StepGeom_bssfSurfOfLinearExtrusion:
-      SW.SendEnum(bssfSurfOfLinearExtrusion);
-      break;
-    case StepGeom_bssfPlaneSurf:
-      SW.SendEnum(bssfPlaneSurf);
-      break;
-    case StepGeom_bssfGeneralisedCone:
-      SW.SendEnum(bssfGeneralisedCone);
-      break;
-    case StepGeom_bssfToroidalSurf:
-      SW.SendEnum(bssfToroidalSurf);
-      break;
-    case StepGeom_bssfConicalSurf:
-      SW.SendEnum(bssfConicalSurf);
-      break;
-    case StepGeom_bssfSphericalSurf:
-      SW.SendEnum(bssfSphericalSurf);
-      break;
-    case StepGeom_bssfUnspecified:
-      SW.SendEnum(bssfUnspecified);
-      break;
-    case StepGeom_bssfRuledSurf:
-      SW.SendEnum(bssfRuledSurf);
-      break;
-    case StepGeom_bssfSurfOfRevolution:
-      SW.SendEnum(bssfSurfOfRevolution);
-      break;
-    case StepGeom_bssfCylindricalSurf:
-      SW.SendEnum(bssfCylindricalSurf);
-      break;
-    case StepGeom_bssfQuadricSurf:
-      SW.SendEnum(bssfQuadricSurf);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineSurfaceForm::ConvertToString(ent->SurfaceForm()));
+
   // --- field : uClosed ---
 
   SW.SendLogical(ent->UClosed());
index a6c051ff603f879a24649c4a34cda7a691668d31..2809c8bec7b28400d12402ef10b52e2456e1af2b 100644 (file)
 #include <StepGeom_RationalBSplineCurve.hxx>
 #include <TColStd_HArray1OfReal.hxx>
 
-// --- Enum : BSplineCurveForm ---
-static TCollection_AsciiString bscfEllipticArc(".ELLIPTIC_ARC.");
-static TCollection_AsciiString bscfPolylineForm(".POLYLINE_FORM.");
-static TCollection_AsciiString bscfParabolicArc(".PARABOLIC_ARC.");
-static TCollection_AsciiString bscfCircularArc(".CIRCULAR_ARC.");
-static TCollection_AsciiString bscfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bscfHyperbolicArc(".HYPERBOLIC_ARC.");
+#include "RWStepGeom_RWBSplineCurveForm.pxx"
 
 RWStepGeom_RWRationalBSplineCurve::RWStepGeom_RWRationalBSplineCurve() {}
 
@@ -82,20 +76,10 @@ void RWStepGeom_RWRationalBSplineCurve::ReadStep(
   if (data->ParamType(num, 4) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 4);
-    if (bscfEllipticArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfEllipticArc;
-    else if (bscfPolylineForm.IsEqual(text))
-      aCurveForm = StepGeom_bscfPolylineForm;
-    else if (bscfParabolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfParabolicArc;
-    else if (bscfCircularArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfCircularArc;
-    else if (bscfUnspecified.IsEqual(text))
-      aCurveForm = StepGeom_bscfUnspecified;
-    else if (bscfHyperbolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfHyperbolicArc;
-    else
+    if (!RWStepGeom_RWBSplineCurveForm::ConvertToEnum(text, aCurveForm))
+    {
       ach->AddFail("Enumeration b_spline_curve_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #4 (curve_form) is not an enumeration");
@@ -164,27 +148,7 @@ void RWStepGeom_RWRationalBSplineCurve::WriteStep(
 
   // --- inherited field curveForm ---
 
-  switch (ent->CurveForm())
-  {
-    case StepGeom_bscfEllipticArc:
-      SW.SendEnum(bscfEllipticArc);
-      break;
-    case StepGeom_bscfPolylineForm:
-      SW.SendEnum(bscfPolylineForm);
-      break;
-    case StepGeom_bscfParabolicArc:
-      SW.SendEnum(bscfParabolicArc);
-      break;
-    case StepGeom_bscfCircularArc:
-      SW.SendEnum(bscfCircularArc);
-      break;
-    case StepGeom_bscfUnspecified:
-      SW.SendEnum(bscfUnspecified);
-      break;
-    case StepGeom_bscfHyperbolicArc:
-      SW.SendEnum(bscfHyperbolicArc);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineCurveForm::ConvertToString(ent->CurveForm()));
 
   // --- inherited field closedCurve ---
 
index efd45982e72c79daf809fe2351ef170606249b0b..83cf6bda17bfd086d767ebf987c89c30ec46b71d 100644 (file)
 #include <StepGeom_RationalBSplineSurface.hxx>
 #include <TColStd_HArray2OfReal.hxx>
 
-// --- Enum : BSplineSurfaceForm ---
-static TCollection_AsciiString bssfSurfOfLinearExtrusion(".SURF_OF_LINEAR_EXTRUSION.");
-static TCollection_AsciiString bssfPlaneSurf(".PLANE_SURF.");
-static TCollection_AsciiString bssfGeneralisedCone(".GENERALISED_CONE.");
-static TCollection_AsciiString bssfToroidalSurf(".TOROIDAL_SURF.");
-static TCollection_AsciiString bssfConicalSurf(".CONICAL_SURF.");
-static TCollection_AsciiString bssfSphericalSurf(".SPHERICAL_SURF.");
-static TCollection_AsciiString bssfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bssfRuledSurf(".RULED_SURF.");
-static TCollection_AsciiString bssfSurfOfRevolution(".SURF_OF_REVOLUTION.");
-static TCollection_AsciiString bssfCylindricalSurf(".CYLINDRICAL_SURF.");
-static TCollection_AsciiString bssfQuadricSurf(".QUADRIC_SURF.");
+#include "RWStepGeom_RWBSplineSurfaceForm.pxx"
 
 RWStepGeom_RWRationalBSplineSurface::RWStepGeom_RWRationalBSplineSurface() {}
 
@@ -101,30 +90,10 @@ void RWStepGeom_RWRationalBSplineSurface::ReadStep(
   if (data->ParamType(num, 5) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 5);
-    if (bssfSurfOfLinearExtrusion.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfLinearExtrusion;
-    else if (bssfPlaneSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfPlaneSurf;
-    else if (bssfGeneralisedCone.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfGeneralisedCone;
-    else if (bssfToroidalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfToroidalSurf;
-    else if (bssfConicalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfConicalSurf;
-    else if (bssfSphericalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSphericalSurf;
-    else if (bssfUnspecified.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfUnspecified;
-    else if (bssfRuledSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfRuledSurf;
-    else if (bssfSurfOfRevolution.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfRevolution;
-    else if (bssfCylindricalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfCylindricalSurf;
-    else if (bssfQuadricSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfQuadricSurf;
-    else
+    if (!RWStepGeom_RWBSplineSurfaceForm::ConvertToEnum(text, aSurfaceForm))
+    {
       ach->AddFail("Enumeration b_spline_surface_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #5 (surface_form) is not an enumeration");
@@ -220,42 +189,7 @@ void RWStepGeom_RWRationalBSplineSurface::WriteStep(
 
   // --- inherited field surfaceForm ---
 
-  switch (ent->SurfaceForm())
-  {
-    case StepGeom_bssfSurfOfLinearExtrusion:
-      SW.SendEnum(bssfSurfOfLinearExtrusion);
-      break;
-    case StepGeom_bssfPlaneSurf:
-      SW.SendEnum(bssfPlaneSurf);
-      break;
-    case StepGeom_bssfGeneralisedCone:
-      SW.SendEnum(bssfGeneralisedCone);
-      break;
-    case StepGeom_bssfToroidalSurf:
-      SW.SendEnum(bssfToroidalSurf);
-      break;
-    case StepGeom_bssfConicalSurf:
-      SW.SendEnum(bssfConicalSurf);
-      break;
-    case StepGeom_bssfSphericalSurf:
-      SW.SendEnum(bssfSphericalSurf);
-      break;
-    case StepGeom_bssfUnspecified:
-      SW.SendEnum(bssfUnspecified);
-      break;
-    case StepGeom_bssfRuledSurf:
-      SW.SendEnum(bssfRuledSurf);
-      break;
-    case StepGeom_bssfSurfOfRevolution:
-      SW.SendEnum(bssfSurfOfRevolution);
-      break;
-    case StepGeom_bssfCylindricalSurf:
-      SW.SendEnum(bssfCylindricalSurf);
-      break;
-    case StepGeom_bssfQuadricSurf:
-      SW.SendEnum(bssfQuadricSurf);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineSurfaceForm::ConvertToString(ent->SurfaceForm()));
 
   // --- inherited field uClosed ---
 
index 18f1739ec360c8fd3114c722ff437adaeb6fd8cc..6f1d9488b32b8a0e2677cf4f6c720c01245b5428 100644 (file)
 #include <StepGeom_ReparametrisedCompositeCurveSegment.hxx>
 #include <StepGeom_TransitionCode.hxx>
 
-// --- Enum : TransitionCode ---
-static TCollection_AsciiString tcDiscontinuous(".DISCONTINUOUS.");
-static TCollection_AsciiString tcContSameGradientSameCurvature(
-  ".CONT_SAME_GRADIENT_SAME_CURVATURE.");
-static TCollection_AsciiString tcContSameGradient(".CONT_SAME_GRADIENT.");
-static TCollection_AsciiString tcContinuous(".CONTINUOUS.");
+#include "RWStepGeom_RWTransitionCode.pxx"
 
 RWStepGeom_RWReparametrisedCompositeCurveSegment::RWStepGeom_RWReparametrisedCompositeCurveSegment()
 {
@@ -48,16 +43,10 @@ void RWStepGeom_RWReparametrisedCompositeCurveSegment::ReadStep(
   if (data->ParamType(num, 1) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 1);
-    if (tcDiscontinuous.IsEqual(text))
-      aTransition = StepGeom_tcDiscontinuous;
-    else if (tcContSameGradientSameCurvature.IsEqual(text))
-      aTransition = StepGeom_tcContSameGradientSameCurvature;
-    else if (tcContSameGradient.IsEqual(text))
-      aTransition = StepGeom_tcContSameGradient;
-    else if (tcContinuous.IsEqual(text))
-      aTransition = StepGeom_tcContinuous;
-    else
+    if (!RWStepGeom_RWTransitionCode::ConvertToEnum(text, aTransition))
+    {
       ach->AddFail("Enumeration transition_code has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #1 (transition) is not an enumeration");
@@ -92,21 +81,7 @@ void RWStepGeom_RWReparametrisedCompositeCurveSegment::WriteStep(
 
   // --- inherited field transition ---
 
-  switch (ent->Transition())
-  {
-    case StepGeom_tcDiscontinuous:
-      SW.SendEnum(tcDiscontinuous);
-      break;
-    case StepGeom_tcContSameGradientSameCurvature:
-      SW.SendEnum(tcContSameGradientSameCurvature);
-      break;
-    case StepGeom_tcContSameGradient:
-      SW.SendEnum(tcContSameGradient);
-      break;
-    case StepGeom_tcContinuous:
-      SW.SendEnum(tcContinuous);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWTransitionCode::ConvertToString(ent->Transition()));
 
   // --- inherited field sameSense ---
 
index b72dd542377ec849cb3dc33d3b8ea2f7e568842c..e2166c3723c21899a2316949c5a3ad231d8fbc39 100644 (file)
 #include <StepData_StepWriter.hxx>
 #include <StepGeom_SeamCurve.hxx>
 
-// --- Enum : PreferredSurfaceCurveRepresentation ---
-static TCollection_AsciiString pscrPcurveS2(".PCURVE_S2.");
-static TCollection_AsciiString pscrPcurveS1(".PCURVE_S1.");
-static TCollection_AsciiString pscrCurve3d(".CURVE_3D.");
+#include "RWStepGeom_RWPreferredSurfaceCurveRepresentation.pxx"
 
 RWStepGeom_RWSeamCurve::RWStepGeom_RWSeamCurve() {}
 
@@ -76,14 +73,11 @@ void RWStepGeom_RWSeamCurve::ReadStep(const Handle(StepData_StepReaderData)& dat
   if (data->ParamType(num, 4) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 4);
-    if (pscrPcurveS2.IsEqual(text))
-      aMasterRepresentation = StepGeom_pscrPcurveS2;
-    else if (pscrPcurveS1.IsEqual(text))
-      aMasterRepresentation = StepGeom_pscrPcurveS1;
-    else if (pscrCurve3d.IsEqual(text))
-      aMasterRepresentation = StepGeom_pscrCurve3d;
-    else
+    if (!RWStepGeom_RWPreferredSurfaceCurveRepresentation::ConvertToEnum(text,
+                                                                         aMasterRepresentation))
+    {
       ach->AddFail("Enumeration preferred_surface_curve_representation has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #4 (master_representation) is not an enumeration");
@@ -116,18 +110,8 @@ void RWStepGeom_RWSeamCurve::WriteStep(StepData_StepWriter&              SW,
 
   // --- inherited field masterRepresentation ---
 
-  switch (ent->MasterRepresentation())
-  {
-    case StepGeom_pscrPcurveS2:
-      SW.SendEnum(pscrPcurveS2);
-      break;
-    case StepGeom_pscrPcurveS1:
-      SW.SendEnum(pscrPcurveS1);
-      break;
-    case StepGeom_pscrCurve3d:
-      SW.SendEnum(pscrCurve3d);
-      break;
-  }
+  SW.SendEnum(
+    RWStepGeom_RWPreferredSurfaceCurveRepresentation::ConvertToString(ent->MasterRepresentation()));
 }
 
 void RWStepGeom_RWSeamCurve::Share(const Handle(StepGeom_SeamCurve)& ent,
index 693eb655cc14fd153f3a340b00a9423eb8d058bd..dfcf42a2f61ec4d29d8f7639717a9b8877be42f1 100644 (file)
 #include <StepGeom_SurfaceCurve.hxx>
 #include <TCollection_AsciiString.hxx>
 
-// --- Enum : PreferredSurfaceCurveRepresentation ---
-static TCollection_AsciiString pscrPcurveS2(".PCURVE_S2.");
-static TCollection_AsciiString pscrPcurveS1(".PCURVE_S1.");
-static TCollection_AsciiString pscrCurve3d(".CURVE_3D.");
+#include "RWStepGeom_RWPreferredSurfaceCurveRepresentation.pxx"
 
 RWStepGeom_RWSurfaceCurve::RWStepGeom_RWSurfaceCurve() {}
 
@@ -72,14 +69,11 @@ void RWStepGeom_RWSurfaceCurve::ReadStep(const Handle(StepData_StepReaderData)&
   if (data->ParamType(num, 4) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 4);
-    if (pscrPcurveS2.IsEqual(text))
-      aMasterRepresentation = StepGeom_pscrPcurveS2;
-    else if (pscrPcurveS1.IsEqual(text))
-      aMasterRepresentation = StepGeom_pscrPcurveS1;
-    else if (pscrCurve3d.IsEqual(text))
-      aMasterRepresentation = StepGeom_pscrCurve3d;
-    else
+    if (!RWStepGeom_RWPreferredSurfaceCurveRepresentation::ConvertToEnum(text,
+                                                                         aMasterRepresentation))
+    {
       ach->AddFail("Enumeration preferred_surface_curve_representation has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #4 (master_representation) is not an enumeration");
@@ -115,18 +109,8 @@ void RWStepGeom_RWSurfaceCurve::WriteStep(StepData_StepWriter&                 S
 
   // --- own field : masterRepresentation ---
 
-  switch (ent->MasterRepresentation())
-  {
-    case StepGeom_pscrPcurveS2:
-      SW.SendEnum(pscrPcurveS2);
-      break;
-    case StepGeom_pscrPcurveS1:
-      SW.SendEnum(pscrPcurveS1);
-      break;
-    case StepGeom_pscrCurve3d:
-      SW.SendEnum(pscrCurve3d);
-      break;
-  }
+  SW.SendEnum(
+    RWStepGeom_RWPreferredSurfaceCurveRepresentation::ConvertToString(ent->MasterRepresentation()));
 }
 
 void RWStepGeom_RWSurfaceCurve::Share(const Handle(StepGeom_SurfaceCurve)& ent,
index 77a4c01e8a0c71429cb910671ef4da7c0236c5e0..a08a57ad2118039f8b0bbe038a7a20acc76447fc 100644 (file)
 #include <StepGeom_SurfaceCurveAndBoundedCurve.hxx>
 #include <TCollection_AsciiString.hxx>
 
-// --- Enum : PreferredSurfaceCurveRepresentation ---
-static TCollection_AsciiString pscrPcurveS2(".PCURVE_S2.");
-static TCollection_AsciiString pscrPcurveS1(".PCURVE_S1.");
-static TCollection_AsciiString pscrCurve3d(".CURVE_3D.");
+#include "RWStepGeom_RWPreferredSurfaceCurveRepresentation.pxx"
 
 RWStepGeom_RWSurfaceCurveAndBoundedCurve::RWStepGeom_RWSurfaceCurveAndBoundedCurve() {}
 
@@ -90,14 +87,11 @@ void RWStepGeom_RWSurfaceCurveAndBoundedCurve::ReadStep(
   if (data->ParamType(num1, 3) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num1, 3);
-    if (pscrPcurveS2.IsEqual(text))
-      aMasterRepresentation = StepGeom_pscrPcurveS2;
-    else if (pscrPcurveS1.IsEqual(text))
-      aMasterRepresentation = StepGeom_pscrPcurveS1;
-    else if (pscrCurve3d.IsEqual(text))
-      aMasterRepresentation = StepGeom_pscrCurve3d;
-    else
+    if (!RWStepGeom_RWPreferredSurfaceCurveRepresentation::ConvertToEnum(text,
+                                                                         aMasterRepresentation))
+    {
       ach->AddFail("Enumeration preferred_surface_curve_representation has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #3 (master_representation) is not an enumeration");
@@ -139,18 +133,8 @@ void RWStepGeom_RWSurfaceCurveAndBoundedCurve::WriteStep(
   SW.CloseSub();
 
   // --- own field : masterRepresentation ---
-  switch (ent->MasterRepresentation())
-  {
-    case StepGeom_pscrPcurveS2:
-      SW.SendEnum(pscrPcurveS2);
-      break;
-    case StepGeom_pscrPcurveS1:
-      SW.SendEnum(pscrPcurveS1);
-      break;
-    case StepGeom_pscrCurve3d:
-      SW.SendEnum(pscrCurve3d);
-      break;
-  }
+  SW.SendEnum(
+    RWStepGeom_RWPreferredSurfaceCurveRepresentation::ConvertToString(ent->MasterRepresentation()));
 }
 
 void RWStepGeom_RWSurfaceCurveAndBoundedCurve::Share(
index 9419000acc94a0447f0aad25b6a3beeaead3f343..a9b64b31e014ba81d7d7f6bd968dcc3419d7791f 100644 (file)
 #include <StepGeom_TransitionCode.hxx>
 #include <TCollection_AsciiString.hxx>
 
-// --- Enum : TransitionCode ---
-static TCollection_AsciiString tcDiscontinuous(".DISCONTINUOUS.");
-static TCollection_AsciiString tcContSameGradientSameCurvature(
-  ".CONT_SAME_GRADIENT_SAME_CURVATURE.");
-static TCollection_AsciiString tcContSameGradient(".CONT_SAME_GRADIENT.");
-static TCollection_AsciiString tcContinuous(".CONTINUOUS.");
+#include "RWStepGeom_RWTransitionCode.pxx"
 
 RWStepGeom_RWSurfacePatch::RWStepGeom_RWSurfacePatch() {}
 
@@ -57,16 +52,10 @@ void RWStepGeom_RWSurfacePatch::ReadStep(const Handle(StepData_StepReaderData)&
   if (data->ParamType(num, 2) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 2);
-    if (tcDiscontinuous.IsEqual(text))
-      aUTransition = StepGeom_tcDiscontinuous;
-    else if (tcContSameGradientSameCurvature.IsEqual(text))
-      aUTransition = StepGeom_tcContSameGradientSameCurvature;
-    else if (tcContSameGradient.IsEqual(text))
-      aUTransition = StepGeom_tcContSameGradient;
-    else if (tcContinuous.IsEqual(text))
-      aUTransition = StepGeom_tcContinuous;
-    else
+    if (!RWStepGeom_RWTransitionCode::ConvertToEnum(text, aUTransition))
+    {
       ach->AddFail("Enumeration transition_code has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #2 (u_transition) is not an enumeration");
@@ -77,16 +66,10 @@ void RWStepGeom_RWSurfacePatch::ReadStep(const Handle(StepData_StepReaderData)&
   if (data->ParamType(num, 3) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 3);
-    if (tcDiscontinuous.IsEqual(text))
-      aVTransition = StepGeom_tcDiscontinuous;
-    else if (tcContSameGradientSameCurvature.IsEqual(text))
-      aVTransition = StepGeom_tcContSameGradientSameCurvature;
-    else if (tcContSameGradient.IsEqual(text))
-      aVTransition = StepGeom_tcContSameGradient;
-    else if (tcContinuous.IsEqual(text))
-      aVTransition = StepGeom_tcContinuous;
-    else
+    if (!RWStepGeom_RWTransitionCode::ConvertToEnum(text, aVTransition))
+    {
       ach->AddFail("Enumeration transition_code has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #3 (v_transition) is not an enumeration");
@@ -118,39 +101,11 @@ void RWStepGeom_RWSurfacePatch::WriteStep(StepData_StepWriter&                 S
 
   // --- own field : uTransition ---
 
-  switch (ent->UTransition())
-  {
-    case StepGeom_tcDiscontinuous:
-      SW.SendEnum(tcDiscontinuous);
-      break;
-    case StepGeom_tcContSameGradientSameCurvature:
-      SW.SendEnum(tcContSameGradientSameCurvature);
-      break;
-    case StepGeom_tcContSameGradient:
-      SW.SendEnum(tcContSameGradient);
-      break;
-    case StepGeom_tcContinuous:
-      SW.SendEnum(tcContinuous);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWTransitionCode::ConvertToString(ent->UTransition()));
 
   // --- own field : vTransition ---
 
-  switch (ent->VTransition())
-  {
-    case StepGeom_tcDiscontinuous:
-      SW.SendEnum(tcDiscontinuous);
-      break;
-    case StepGeom_tcContSameGradientSameCurvature:
-      SW.SendEnum(tcContSameGradientSameCurvature);
-      break;
-    case StepGeom_tcContSameGradient:
-      SW.SendEnum(tcContSameGradient);
-      break;
-    case StepGeom_tcContinuous:
-      SW.SendEnum(tcContinuous);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWTransitionCode::ConvertToString(ent->VTransition()));
 
   // --- own field : uSense ---
 
diff --git a/src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWTransitionCode.pxx b/src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWTransitionCode.pxx
new file mode 100644 (file)
index 0000000..055dfe6
--- /dev/null
@@ -0,0 +1,77 @@
+// Copyright (c) 2025 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 _RWStepGeom_RWTransitionCode_HeaderFile
+#define _RWStepGeom_RWTransitionCode_HeaderFile
+
+#include <StepGeom_TransitionCode.hxx>
+#include <Standard_CString.hxx>
+
+namespace RWStepGeom_RWTransitionCode
+{
+static constexpr char tcDiscontinuous[]                 = ".DISCONTINUOUS.";
+static constexpr char tcContSameGradientSameCurvature[] = ".CONT_SAME_GRADIENT_SAME_CURVATURE.";
+static constexpr char tcContSameGradient[]              = ".CONT_SAME_GRADIENT.";
+static constexpr char tcContinuous[]                    = ".CONTINUOUS.";
+
+//! Convert StepGeom_TransitionCode to string
+//! @param theTransitionCodeEnum The StepGeom_TransitionCode value to convert
+//! @return The corresponding string representation
+inline const char* ConvertToString(const StepGeom_TransitionCode theTransitionCodeEnum)
+{
+  switch (theTransitionCodeEnum)
+  {
+    case StepGeom_tcDiscontinuous:
+      return tcDiscontinuous;
+    case StepGeom_tcContSameGradientSameCurvature:
+      return tcContSameGradientSameCurvature;
+    case StepGeom_tcContSameGradient:
+      return tcContSameGradient;
+    case StepGeom_tcContinuous:
+      return tcContinuous;
+  }
+  return nullptr;
+}
+
+//! Convert string to StepGeom_TransitionCode
+//! @param theTransitionCodeStr The string to convert
+//! @param theResultEnum The corresponding StepGeom_TransitionCode value
+//! @return Standard_True if the conversion was successful, Standard_False otherwise
+inline bool ConvertToEnum(const Standard_CString   theTransitionCodeStr,
+                          StepGeom_TransitionCode& theResultEnum)
+{
+  if (IsEqual(theTransitionCodeStr, tcDiscontinuous))
+  {
+    theResultEnum = StepGeom_tcDiscontinuous;
+  }
+  else if (IsEqual(theTransitionCodeStr, tcContSameGradientSameCurvature))
+  {
+    theResultEnum = StepGeom_tcContSameGradientSameCurvature;
+  }
+  else if (IsEqual(theTransitionCodeStr, tcContSameGradient))
+  {
+    theResultEnum = StepGeom_tcContSameGradient;
+  }
+  else if (IsEqual(theTransitionCodeStr, tcContinuous))
+  {
+    theResultEnum = StepGeom_tcContinuous;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+} // namespace RWStepGeom_RWTransitionCode
+
+#endif // _RWStepGeom_RWTransitionCode_HeaderFile
index 380347eef636b776da6379379f6d3fc70a22a4b7..2aa042fead2b7871952b05f503f265403a121b8e 100644 (file)
 #include <StepGeom_TrimmingSelect.hxx>
 #include <TCollection_AsciiString.hxx>
 
-// --- Enum : TrimmingPreference ---
-static TCollection_AsciiString tpParameter(".PARAMETER.");
-static TCollection_AsciiString tpUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString tpCartesian(".CARTESIAN.");
+#include "RWStepGeom_RWTrimmingPreference.pxx"
 
 RWStepGeom_RWTrimmedCurve::RWStepGeom_RWTrimmedCurve() {}
 
@@ -102,14 +99,10 @@ void RWStepGeom_RWTrimmedCurve::ReadStep(const Handle(StepData_StepReaderData)&
   if (data->ParamType(num, 6) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 6);
-    if (tpParameter.IsEqual(text))
-      aMasterRepresentation = StepGeom_tpParameter;
-    else if (tpUnspecified.IsEqual(text))
-      aMasterRepresentation = StepGeom_tpUnspecified;
-    else if (tpCartesian.IsEqual(text))
-      aMasterRepresentation = StepGeom_tpCartesian;
-    else
+    if (!RWStepGeom_RWTrimmingPreference::ConvertToEnum(text, aMasterRepresentation))
+    {
       ach->AddFail("Enumeration trimming_preference has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #6 (master_representation) is not an enumeration");
@@ -155,18 +148,7 @@ void RWStepGeom_RWTrimmedCurve::WriteStep(StepData_StepWriter&                 S
 
   // --- own field : masterRepresentation ---
 
-  switch (ent->MasterRepresentation())
-  {
-    case StepGeom_tpParameter:
-      SW.SendEnum(tpParameter);
-      break;
-    case StepGeom_tpUnspecified:
-      SW.SendEnum(tpUnspecified);
-      break;
-    case StepGeom_tpCartesian:
-      SW.SendEnum(tpCartesian);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWTrimmingPreference::ConvertToString(ent->MasterRepresentation()));
 }
 
 void RWStepGeom_RWTrimmedCurve::Share(const Handle(StepGeom_TrimmedCurve)& ent,
diff --git a/src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWTrimmingPreference.pxx b/src/DataExchange/TKDESTEP/RWStepGeom/RWStepGeom_RWTrimmingPreference.pxx
new file mode 100644 (file)
index 0000000..d0f485d
--- /dev/null
@@ -0,0 +1,70 @@
+// Copyright (c) 2025 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 _RWStepGeom_RWTrimmingPreference_HeaderFile
+#define _RWStepGeom_RWTrimmingPreference_HeaderFile
+
+#include <StepGeom_TrimmingPreference.hxx>
+#include <Standard_CString.hxx>
+
+namespace RWStepGeom_RWTrimmingPreference
+{
+static constexpr char tpParameter[]   = ".PARAMETER.";
+static constexpr char tpUnspecified[] = ".UNSPECIFIED.";
+static constexpr char tpCartesian[]   = ".CARTESIAN.";
+
+//! Convert StepGeom_TrimmingPreference to string
+//! @param theSourceEnum The StepGeom_TrimmingPreference value to convert
+//! @return The corresponding string representation or nullptr if not found
+inline const char* ConvertToString(const StepGeom_TrimmingPreference theSourceEnum)
+{
+  switch (theSourceEnum)
+  {
+    case StepGeom_tpParameter:
+      return tpParameter;
+    case StepGeom_tpUnspecified:
+      return tpUnspecified;
+    case StepGeom_tpCartesian:
+      return tpCartesian;
+  }
+  return nullptr;
+}
+
+//! Convert string to StepGeom_TrimmingPreference
+//! @param thePreferenceStr The string to convert
+//! @param theResultEnum The corresponding StepGeom_TrimmingPreference value
+//! @return Standard_True if the conversion was successful, Standard_False otherwise
+inline bool ConvertToEnum(const Standard_CString       thePreferenceStr,
+                          StepGeom_TrimmingPreference& theResultEnum)
+{
+  if (IsEqual(thePreferenceStr, tpParameter))
+  {
+    theResultEnum = StepGeom_tpParameter;
+  }
+  else if (IsEqual(thePreferenceStr, tpUnspecified))
+  {
+    theResultEnum = StepGeom_tpUnspecified;
+  }
+  else if (IsEqual(thePreferenceStr, tpCartesian))
+  {
+    theResultEnum = StepGeom_tpCartesian;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+} // namespace RWStepGeom_RWTrimmingPreference
+
+#endif // _RWStepGeom_RWTrimmingPreference_HeaderFile
index 86afb0eac7afbef8ce6a614e3471487a9c4acbe0..966f72bc2598abacdc057fd64e4b876ff09e8977 100644 (file)
 #include <StepData_StepWriter.hxx>
 #include <StepGeom_UniformCurve.hxx>
 
-// --- Enum : BSplineCurveForm ---
-static TCollection_AsciiString bscfEllipticArc(".ELLIPTIC_ARC.");
-static TCollection_AsciiString bscfPolylineForm(".POLYLINE_FORM.");
-static TCollection_AsciiString bscfParabolicArc(".PARABOLIC_ARC.");
-static TCollection_AsciiString bscfCircularArc(".CIRCULAR_ARC.");
-static TCollection_AsciiString bscfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bscfHyperbolicArc(".HYPERBOLIC_ARC.");
+#include "RWStepGeom_RWBSplineCurveForm.pxx"
 
 RWStepGeom_RWUniformCurve::RWStepGeom_RWUniformCurve() {}
 
@@ -79,20 +73,10 @@ void RWStepGeom_RWUniformCurve::ReadStep(const Handle(StepData_StepReaderData)&
   if (data->ParamType(num, 4) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 4);
-    if (bscfEllipticArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfEllipticArc;
-    else if (bscfPolylineForm.IsEqual(text))
-      aCurveForm = StepGeom_bscfPolylineForm;
-    else if (bscfParabolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfParabolicArc;
-    else if (bscfCircularArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfCircularArc;
-    else if (bscfUnspecified.IsEqual(text))
-      aCurveForm = StepGeom_bscfUnspecified;
-    else if (bscfHyperbolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfHyperbolicArc;
-    else
+    if (!RWStepGeom_RWBSplineCurveForm::ConvertToEnum(text, aCurveForm))
+    {
       ach->AddFail("Enumeration b_spline_curve_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #4 (curve_form) is not an enumeration");
@@ -137,27 +121,7 @@ void RWStepGeom_RWUniformCurve::WriteStep(StepData_StepWriter&                 S
 
   // --- inherited field curveForm ---
 
-  switch (ent->CurveForm())
-  {
-    case StepGeom_bscfEllipticArc:
-      SW.SendEnum(bscfEllipticArc);
-      break;
-    case StepGeom_bscfPolylineForm:
-      SW.SendEnum(bscfPolylineForm);
-      break;
-    case StepGeom_bscfParabolicArc:
-      SW.SendEnum(bscfParabolicArc);
-      break;
-    case StepGeom_bscfCircularArc:
-      SW.SendEnum(bscfCircularArc);
-      break;
-    case StepGeom_bscfUnspecified:
-      SW.SendEnum(bscfUnspecified);
-      break;
-    case StepGeom_bscfHyperbolicArc:
-      SW.SendEnum(bscfHyperbolicArc);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineCurveForm::ConvertToString(ent->CurveForm()));
 
   // --- inherited field closedCurve ---
 
index 88c718290ef21390634f20f6c38a91633f2e071c..fac578cb92be6bcfbf695bdf68190318e198f270 100644 (file)
 #include <StepGeom_UniformCurveAndRationalBSplineCurve.hxx>
 #include <TColStd_HArray1OfReal.hxx>
 
-// --- Enum : BSplineCurveForm ---
-static TCollection_AsciiString bscfEllipticArc(".ELLIPTIC_ARC.");
-static TCollection_AsciiString bscfPolylineForm(".POLYLINE_FORM.");
-static TCollection_AsciiString bscfParabolicArc(".PARABOLIC_ARC.");
-static TCollection_AsciiString bscfCircularArc(".CIRCULAR_ARC.");
-static TCollection_AsciiString bscfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bscfHyperbolicArc(".HYPERBOLIC_ARC.");
+#include <RWStepGeom_RWBSplineCurveForm.pxx>
 
 RWStepGeom_RWUniformCurveAndRationalBSplineCurve::RWStepGeom_RWUniformCurveAndRationalBSplineCurve()
 {
@@ -86,20 +80,10 @@ void RWStepGeom_RWUniformCurveAndRationalBSplineCurve::ReadStep(
   if (data->ParamType(num, 3) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 3);
-    if (bscfEllipticArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfEllipticArc;
-    else if (bscfPolylineForm.IsEqual(text))
-      aCurveForm = StepGeom_bscfPolylineForm;
-    else if (bscfParabolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfParabolicArc;
-    else if (bscfCircularArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfCircularArc;
-    else if (bscfUnspecified.IsEqual(text))
-      aCurveForm = StepGeom_bscfUnspecified;
-    else if (bscfHyperbolicArc.IsEqual(text))
-      aCurveForm = StepGeom_bscfHyperbolicArc;
-    else
+    if (!RWStepGeom_RWBSplineCurveForm::ConvertToEnum(text, aCurveForm))
+    {
       ach->AddFail("Enumeration b_spline_curve_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #3 (curve_form) is not an enumeration");
@@ -208,27 +192,8 @@ void RWStepGeom_RWUniformCurveAndRationalBSplineCurve::WriteStep(
   SW.CloseSub();
   // --- field : curveForm ---
 
-  switch (ent->CurveForm())
-  {
-    case StepGeom_bscfEllipticArc:
-      SW.SendEnum(bscfEllipticArc);
-      break;
-    case StepGeom_bscfPolylineForm:
-      SW.SendEnum(bscfPolylineForm);
-      break;
-    case StepGeom_bscfParabolicArc:
-      SW.SendEnum(bscfParabolicArc);
-      break;
-    case StepGeom_bscfCircularArc:
-      SW.SendEnum(bscfCircularArc);
-      break;
-    case StepGeom_bscfUnspecified:
-      SW.SendEnum(bscfUnspecified);
-      break;
-    case StepGeom_bscfHyperbolicArc:
-      SW.SendEnum(bscfHyperbolicArc);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineCurveForm::ConvertToString(ent->CurveForm()));
+
   // --- field : closedCurve ---
 
   SW.SendLogical(ent->ClosedCurve());
index a830651f69df5f59d47041e299edc992a8d48cdf..516e72068171b4d4fddf7d9133caacdafc0d159e 100644 (file)
 #include <StepData_StepWriter.hxx>
 #include <StepGeom_UniformSurface.hxx>
 
-// --- Enum : BSplineSurfaceForm ---
-static TCollection_AsciiString bssfSurfOfLinearExtrusion(".SURF_OF_LINEAR_EXTRUSION.");
-static TCollection_AsciiString bssfPlaneSurf(".PLANE_SURF.");
-static TCollection_AsciiString bssfGeneralisedCone(".GENERALISED_CONE.");
-static TCollection_AsciiString bssfToroidalSurf(".TOROIDAL_SURF.");
-static TCollection_AsciiString bssfConicalSurf(".CONICAL_SURF.");
-static TCollection_AsciiString bssfSphericalSurf(".SPHERICAL_SURF.");
-static TCollection_AsciiString bssfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bssfRuledSurf(".RULED_SURF.");
-static TCollection_AsciiString bssfSurfOfRevolution(".SURF_OF_REVOLUTION.");
-static TCollection_AsciiString bssfCylindricalSurf(".CYLINDRICAL_SURF.");
-static TCollection_AsciiString bssfQuadricSurf(".QUADRIC_SURF.");
+#include "RWStepGeom_RWBSplineSurfaceForm.pxx"
 
 RWStepGeom_RWUniformSurface::RWStepGeom_RWUniformSurface() {}
 
@@ -98,30 +87,10 @@ void RWStepGeom_RWUniformSurface::ReadStep(const Handle(StepData_StepReaderData)
   if (data->ParamType(num, 5) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 5);
-    if (bssfSurfOfLinearExtrusion.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfLinearExtrusion;
-    else if (bssfPlaneSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfPlaneSurf;
-    else if (bssfGeneralisedCone.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfGeneralisedCone;
-    else if (bssfToroidalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfToroidalSurf;
-    else if (bssfConicalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfConicalSurf;
-    else if (bssfSphericalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSphericalSurf;
-    else if (bssfUnspecified.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfUnspecified;
-    else if (bssfRuledSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfRuledSurf;
-    else if (bssfSurfOfRevolution.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfRevolution;
-    else if (bssfCylindricalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfCylindricalSurf;
-    else if (bssfQuadricSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfQuadricSurf;
-    else
+    if (!RWStepGeom_RWBSplineSurfaceForm::ConvertToEnum(text, aSurfaceForm))
+    {
       ach->AddFail("Enumeration b_spline_surface_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #5 (surface_form) is not an enumeration");
@@ -190,42 +159,7 @@ void RWStepGeom_RWUniformSurface::WriteStep(StepData_StepWriter&
 
   // --- inherited field surfaceForm ---
 
-  switch (ent->SurfaceForm())
-  {
-    case StepGeom_bssfSurfOfLinearExtrusion:
-      SW.SendEnum(bssfSurfOfLinearExtrusion);
-      break;
-    case StepGeom_bssfPlaneSurf:
-      SW.SendEnum(bssfPlaneSurf);
-      break;
-    case StepGeom_bssfGeneralisedCone:
-      SW.SendEnum(bssfGeneralisedCone);
-      break;
-    case StepGeom_bssfToroidalSurf:
-      SW.SendEnum(bssfToroidalSurf);
-      break;
-    case StepGeom_bssfConicalSurf:
-      SW.SendEnum(bssfConicalSurf);
-      break;
-    case StepGeom_bssfSphericalSurf:
-      SW.SendEnum(bssfSphericalSurf);
-      break;
-    case StepGeom_bssfUnspecified:
-      SW.SendEnum(bssfUnspecified);
-      break;
-    case StepGeom_bssfRuledSurf:
-      SW.SendEnum(bssfRuledSurf);
-      break;
-    case StepGeom_bssfSurfOfRevolution:
-      SW.SendEnum(bssfSurfOfRevolution);
-      break;
-    case StepGeom_bssfCylindricalSurf:
-      SW.SendEnum(bssfCylindricalSurf);
-      break;
-    case StepGeom_bssfQuadricSurf:
-      SW.SendEnum(bssfQuadricSurf);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineSurfaceForm::ConvertToString(ent->SurfaceForm()));
 
   // --- inherited field uClosed ---
 
index f47aba98bdf6a058c4efd815f1b548a48e39b946..b72b506969ef323aa16bac8a4aee50e9a1897969 100644 (file)
 #include <StepGeom_UniformSurfaceAndRationalBSplineSurface.hxx>
 #include <TColStd_HArray2OfReal.hxx>
 
-// --- Enum : BSplineSurfaceForm ---
-static TCollection_AsciiString bssfSurfOfLinearExtrusion(".SURF_OF_LINEAR_EXTRUSION.");
-static TCollection_AsciiString bssfPlaneSurf(".PLANE_SURF.");
-static TCollection_AsciiString bssfGeneralisedCone(".GENERALISED_CONE.");
-static TCollection_AsciiString bssfToroidalSurf(".TOROIDAL_SURF.");
-static TCollection_AsciiString bssfConicalSurf(".CONICAL_SURF.");
-static TCollection_AsciiString bssfSphericalSurf(".SPHERICAL_SURF.");
-static TCollection_AsciiString bssfUnspecified(".UNSPECIFIED.");
-static TCollection_AsciiString bssfRuledSurf(".RULED_SURF.");
-static TCollection_AsciiString bssfSurfOfRevolution(".SURF_OF_REVOLUTION.");
-static TCollection_AsciiString bssfCylindricalSurf(".CYLINDRICAL_SURF.");
-static TCollection_AsciiString bssfQuadricSurf(".QUADRIC_SURF.");
+#include "RWStepGeom_RWBSplineSurfaceForm.pxx"
 
 RWStepGeom_RWUniformSurfaceAndRationalBSplineSurface::
   RWStepGeom_RWUniformSurfaceAndRationalBSplineSurface()
@@ -105,30 +94,10 @@ void RWStepGeom_RWUniformSurfaceAndRationalBSplineSurface::ReadStep(
   if (data->ParamType(num, 4) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 4);
-    if (bssfSurfOfLinearExtrusion.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfLinearExtrusion;
-    else if (bssfPlaneSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfPlaneSurf;
-    else if (bssfGeneralisedCone.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfGeneralisedCone;
-    else if (bssfToroidalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfToroidalSurf;
-    else if (bssfConicalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfConicalSurf;
-    else if (bssfSphericalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSphericalSurf;
-    else if (bssfUnspecified.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfUnspecified;
-    else if (bssfRuledSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfRuledSurf;
-    else if (bssfSurfOfRevolution.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfSurfOfRevolution;
-    else if (bssfCylindricalSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfCylindricalSurf;
-    else if (bssfQuadricSurf.IsEqual(text))
-      aSurfaceForm = StepGeom_bssfQuadricSurf;
-    else
+    if (!RWStepGeom_RWBSplineSurfaceForm::ConvertToEnum(text, aSurfaceForm))
+    {
       ach->AddFail("Enumeration b_spline_surface_form has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #4 (surface_form) is not an enumeration");
@@ -262,42 +231,8 @@ void RWStepGeom_RWUniformSurfaceAndRationalBSplineSurface::WriteStep(
   SW.CloseSub();
   // --- field : surfaceForm ---
 
-  switch (ent->SurfaceForm())
-  {
-    case StepGeom_bssfSurfOfLinearExtrusion:
-      SW.SendEnum(bssfSurfOfLinearExtrusion);
-      break;
-    case StepGeom_bssfPlaneSurf:
-      SW.SendEnum(bssfPlaneSurf);
-      break;
-    case StepGeom_bssfGeneralisedCone:
-      SW.SendEnum(bssfGeneralisedCone);
-      break;
-    case StepGeom_bssfToroidalSurf:
-      SW.SendEnum(bssfToroidalSurf);
-      break;
-    case StepGeom_bssfConicalSurf:
-      SW.SendEnum(bssfConicalSurf);
-      break;
-    case StepGeom_bssfSphericalSurf:
-      SW.SendEnum(bssfSphericalSurf);
-      break;
-    case StepGeom_bssfUnspecified:
-      SW.SendEnum(bssfUnspecified);
-      break;
-    case StepGeom_bssfRuledSurf:
-      SW.SendEnum(bssfRuledSurf);
-      break;
-    case StepGeom_bssfSurfOfRevolution:
-      SW.SendEnum(bssfSurfOfRevolution);
-      break;
-    case StepGeom_bssfCylindricalSurf:
-      SW.SendEnum(bssfCylindricalSurf);
-      break;
-    case StepGeom_bssfQuadricSurf:
-      SW.SendEnum(bssfQuadricSurf);
-      break;
-  }
+  SW.SendEnum(RWStepGeom_RWBSplineSurfaceForm::ConvertToString(ent->SurfaceForm()));
+
   // --- field : uClosed ---
 
   SW.SendLogical(ent->UClosed());
index b97ce9acc3c33c0911346b4d37a66e75d99a80c9..0417a849ce8f1927571a0122bc2131a64dce0fc0 100644 (file)
@@ -12,6 +12,7 @@ set(OCCT_RWStepShape_FILES
   RWStepShape_RWAngularSize.pxx
   RWStepShape_RWBlock.cxx
   RWStepShape_RWBlock.pxx
+  RWStepShape_RWBooleanOperator.pxx
   RWStepShape_RWBooleanResult.cxx
   RWStepShape_RWBooleanResult.pxx
   RWStepShape_RWBoxDomain.cxx
diff --git a/src/DataExchange/TKDESTEP/RWStepShape/RWStepShape_RWBooleanOperator.pxx b/src/DataExchange/TKDESTEP/RWStepShape/RWStepShape_RWBooleanOperator.pxx
new file mode 100644 (file)
index 0000000..fcaf7c0
--- /dev/null
@@ -0,0 +1,70 @@
+// Copyright (c) 2025 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 _RWStepShape_RWBooleanOperator_HeaderFile
+#define _RWStepShape_RWBooleanOperator_HeaderFile
+
+#include <StepShape_BooleanOperator.hxx>
+#include <Standard_CString.hxx>
+
+namespace RWStepShape_RWBooleanOperator
+{
+static constexpr char boDifference[]   = ".DIFFERENCE.";
+static constexpr char boIntersection[] = ".INTERSECTION.";
+static constexpr char boUnion[]        = ".UNION.";
+
+//! Convert StepShape_BooleanOperator to string
+//! @param theSourceEnum The StepShape_BooleanOperator value to convert
+//! @return The corresponding string representation or nullptr if not found
+inline const char* ConvertToString(const StepShape_BooleanOperator theSourceEnum)
+{
+  switch (theSourceEnum)
+  {
+    case StepShape_boDifference:
+      return boDifference;
+    case StepShape_boIntersection:
+      return boIntersection;
+    case StepShape_boUnion:
+      return boUnion;
+  }
+  return nullptr;
+}
+
+//! Convert string to StepShape_BooleanOperator
+//! @param theOperatorStr The string to convert
+//! @param theResultEnum The corresponding StepShape_BooleanOperator value
+//! @return Standard_True if the conversion was successful, Standard_False otherwise
+inline bool ConvertToEnum(const Standard_CString     theOperatorStr,
+                          StepShape_BooleanOperator& theResultEnum)
+{
+  if (IsEqual(theOperatorStr, boDifference))
+  {
+    theResultEnum = StepShape_boDifference;
+  }
+  else if (IsEqual(theOperatorStr, boIntersection))
+  {
+    theResultEnum = StepShape_boIntersection;
+  }
+  else if (IsEqual(theOperatorStr, boUnion))
+  {
+    theResultEnum = StepShape_boUnion;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+} // namespace RWStepShape_RWBooleanOperator
+
+#endif // _RWStepShape_RWBooleanOperator_HeaderFile
index ccc8c5aa9e955e70a6ede0129840c844058b4ddb..13418c6a427812f0dbc429d6ac247142f9440c62 100644 (file)
 #include <StepShape_SolidModel.hxx>
 #include <TCollection_AsciiString.hxx>
 
-// --- Enum : BooleanOperator ---
-static TCollection_AsciiString boDifference(".DIFFERENCE.");
-static TCollection_AsciiString boIntersection(".INTERSECTION.");
-static TCollection_AsciiString boUnion(".UNION.");
+#include "RWStepShape_RWBooleanOperator.pxx"
 
 RWStepShape_RWBooleanResult::RWStepShape_RWBooleanResult() {}
 
@@ -49,14 +46,10 @@ void RWStepShape_RWBooleanResult::ReadStep(const Handle(StepData_StepReaderData)
   if (data->ParamType(num, 2) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 2);
-    if (boDifference.IsEqual(text))
-      aOperator = StepShape_boDifference;
-    else if (boIntersection.IsEqual(text))
-      aOperator = StepShape_boIntersection;
-    else if (boUnion.IsEqual(text))
-      aOperator = StepShape_boUnion;
-    else
+    if (!RWStepShape_RWBooleanOperator::ConvertToEnum(text, aOperator))
+    {
       ach->AddFail("Enumeration boolean_operator has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #2 (operator) is not an enumeration");
@@ -117,18 +110,7 @@ void RWStepShape_RWBooleanResult::WriteStep(StepData_StepWriter&
 
   // --- own field : operator ---
 
-  switch (ent->Operator())
-  {
-    case StepShape_boDifference:
-      SW.SendEnum(boDifference);
-      break;
-    case StepShape_boIntersection:
-      SW.SendEnum(boIntersection);
-      break;
-    case StepShape_boUnion:
-      SW.SendEnum(boUnion);
-      break;
-  }
+  SW.SendEnum(RWStepShape_RWBooleanOperator::ConvertToString(ent->Operator()));
 
   // --- own field : firstOperand ---
   // --- idem au ReadStep : il faut envoyer le bon type :
index 5edb1a9aafbbaccb290b213909d6daaa1350d462..dea9e7107c5c7ff539fcd14f75fc5c65939afe9c 100644 (file)
@@ -34,6 +34,7 @@ set(OCCT_RWStepVisual_FILES
   RWStepVisual_RWCameraModelD3MultiClippingUnion.pxx
   RWStepVisual_RWCameraUsage.cxx
   RWStepVisual_RWCameraUsage.pxx
+  RWStepVisual_RWCentralOrParallel.pxx
   RWStepVisual_RWCharacterizedObjAndRepresentationAndDraughtingModel.cxx
   RWStepVisual_RWCharacterizedObjAndRepresentationAndDraughtingModel.pxx
   RWStepVisual_RWColour.cxx
@@ -116,6 +117,7 @@ set(OCCT_RWStepVisual_FILES
   RWStepVisual_RWRepositionedTessellatedItem.pxx
   RWStepVisual_RWStyledItem.cxx
   RWStepVisual_RWStyledItem.pxx
+  RWStepVisual_RWSurfaceSide.pxx
   RWStepVisual_RWSurfaceSideStyle.cxx
   RWStepVisual_RWSurfaceSideStyle.pxx
   RWStepVisual_RWSurfaceStyleBoundary.cxx
@@ -150,6 +152,7 @@ set(OCCT_RWStepVisual_FILES
   RWStepVisual_RWTemplateInstance.pxx
   RWStepVisual_RWTextLiteral.cxx
   RWStepVisual_RWTextLiteral.pxx
+  RWStepVisual_RWTextPath.pxx
   RWStepVisual_RWTextStyle.cxx
   RWStepVisual_RWTextStyle.pxx
   RWStepVisual_RWTextStyleForDefinedFont.cxx
diff --git a/src/DataExchange/TKDESTEP/RWStepVisual/RWStepVisual_RWCentralOrParallel.pxx b/src/DataExchange/TKDESTEP/RWStepVisual/RWStepVisual_RWCentralOrParallel.pxx
new file mode 100644 (file)
index 0000000..7932cb0
--- /dev/null
@@ -0,0 +1,63 @@
+// Copyright (c) 2025 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 _RWStepVisual_RWCentralOrParallel_HeaderFile
+#define _RWStepVisual_RWCentralOrParallel_HeaderFile
+
+#include <StepVisual_CentralOrParallel.hxx>
+#include <Standard_CString.hxx>
+
+namespace RWStepVisual_RWCentralOrParallel
+{
+static constexpr char copCentral[]  = ".CENTRAL.";
+static constexpr char copParallel[] = ".PARALLEL.";
+
+//! Convert StepVisual_CentralOrParallel to string
+//! @param theSourceEnum The StepVisual_CentralOrParallel value to convert
+//! @return The corresponding string representation or nullptr if not found
+inline const char* ConvertToString(const StepVisual_CentralOrParallel theSourceEnum)
+{
+  switch (theSourceEnum)
+  {
+    case StepVisual_copCentral:
+      return copCentral;
+    case StepVisual_copParallel:
+      return copParallel;
+  }
+  return nullptr;
+}
+
+//! Convert string to StepVisual_CentralOrParallel
+//! @param theCentralOrParallelStr The string to convert
+//! @param theResultEnum The corresponding StepVisual_CentralOrParallel value
+//! @return Standard_True if the conversion was successful, Standard_False otherwise
+inline bool ConvertToEnum(const Standard_CString        theCentralOrParallelStr,
+                          StepVisual_CentralOrParallel& theResultEnum)
+{
+  if (IsEqual(theCentralOrParallelStr, copCentral))
+  {
+    theResultEnum = StepVisual_copCentral;
+  }
+  else if (IsEqual(theCentralOrParallelStr, copParallel))
+  {
+    theResultEnum = StepVisual_copParallel;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+} // namespace RWStepVisual_RWCentralOrParallel
+
+#endif // _RWStepVisual_RWCentralOrParallel_HeaderFile
diff --git a/src/DataExchange/TKDESTEP/RWStepVisual/RWStepVisual_RWSurfaceSide.pxx b/src/DataExchange/TKDESTEP/RWStepVisual/RWStepVisual_RWSurfaceSide.pxx
new file mode 100644 (file)
index 0000000..0891d9a
--- /dev/null
@@ -0,0 +1,69 @@
+// Copyright (c) 2025 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 _RWStepVisual_RWSurfaceSide_HeaderFile
+#define _RWStepVisual_RWSurfaceSide_HeaderFile
+
+#include <StepVisual_SurfaceSide.hxx>
+#include <Standard_CString.hxx>
+
+namespace RWStepVisual_RWSurfaceSide
+{
+static constexpr char ssNegative[] = ".NEGATIVE.";
+static constexpr char ssPositive[] = ".POSITIVE.";
+static constexpr char ssBoth[]     = ".BOTH.";
+
+//! Convert StepVisual_SurfaceSide to string
+//! @param theSourceEnum The StepVisual_SurfaceSide value to convert
+//! @return The corresponding string representation or nullptr if not found
+inline const char* ConvertToString(const StepVisual_SurfaceSide theSourceEnum)
+{
+  switch (theSourceEnum)
+  {
+    case StepVisual_ssNegative:
+      return ssNegative;
+    case StepVisual_ssPositive:
+      return ssPositive;
+    case StepVisual_ssBoth:
+      return ssBoth;
+  }
+  return nullptr;
+}
+
+//! Convert string to StepVisual_SurfaceSide
+//! @param theSideStr The string to convert
+//! @param theResultEnum The corresponding StepVisual_SurfaceSide value
+//! @return Standard_True if the conversion was successful, Standard_False otherwise
+inline bool ConvertToEnum(const Standard_CString theSideStr, StepVisual_SurfaceSide& theResultEnum)
+{
+  if (IsEqual(theSideStr, ssNegative))
+  {
+    theResultEnum = StepVisual_ssNegative;
+  }
+  else if (IsEqual(theSideStr, ssPositive))
+  {
+    theResultEnum = StepVisual_ssPositive;
+  }
+  else if (IsEqual(theSideStr, ssBoth))
+  {
+    theResultEnum = StepVisual_ssBoth;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+} // namespace RWStepVisual_RWSurfaceSide
+
+#endif // _RWStepVisual_RWSurfaceSide_HeaderFile
index 11350d64e95319494f5af9d75147558304e6fbdf..2d1a7334b3da9e62b531df024a451c6d48033ed0 100644 (file)
 #include <StepVisual_SurfaceStyleUsage.hxx>
 #include <TCollection_AsciiString.hxx>
 
-// --- Enum : SurfaceSide ---
-static TCollection_AsciiString ssNegative(".NEGATIVE.");
-static TCollection_AsciiString ssPositive(".POSITIVE.");
-static TCollection_AsciiString ssBoth(".BOTH.");
+#include "RWStepVisual_RWSurfaceSide.pxx"
 
 RWStepVisual_RWSurfaceStyleUsage::RWStepVisual_RWSurfaceStyleUsage() {}
 
@@ -44,14 +41,10 @@ void RWStepVisual_RWSurfaceStyleUsage::ReadStep(
   if (data->ParamType(num, 1) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 1);
-    if (ssNegative.IsEqual(text))
-      aSide = StepVisual_ssNegative;
-    else if (ssPositive.IsEqual(text))
-      aSide = StepVisual_ssPositive;
-    else if (ssBoth.IsEqual(text))
-      aSide = StepVisual_ssBoth;
-    else
+    if (!RWStepVisual_RWSurfaceSide::ConvertToEnum(text, aSide))
+    {
       ach->AddFail("Enumeration surface_side has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #1 (side) is not an enumeration");
@@ -74,18 +67,7 @@ void RWStepVisual_RWSurfaceStyleUsage::WriteStep(
 
   // --- own field : side ---
 
-  switch (ent->Side())
-  {
-    case StepVisual_ssNegative:
-      SW.SendEnum(ssNegative);
-      break;
-    case StepVisual_ssPositive:
-      SW.SendEnum(ssPositive);
-      break;
-    case StepVisual_ssBoth:
-      SW.SendEnum(ssBoth);
-      break;
-  }
+  SW.SendEnum(RWStepVisual_RWSurfaceSide::ConvertToString(ent->Side()));
 
   // --- own field : style ---
 
index 5403e1da858db209a534e7b6832c4d96be336512..9ef39be797cd067069df65181f670f12d17aba39 100644 (file)
 #include <StepVisual_TextPath.hxx>
 #include <TCollection_AsciiString.hxx>
 
-// --- Enum : TextPath ---
-static TCollection_AsciiString tpUp(".UP.");
-static TCollection_AsciiString tpRight(".RIGHT.");
-static TCollection_AsciiString tpDown(".DOWN.");
-static TCollection_AsciiString tpLeft(".LEFT.");
+#include "RWStepVisual_RWTextPath.pxx"
 
 RWStepVisual_RWTextLiteral::RWStepVisual_RWTextLiteral() {}
 
@@ -68,16 +64,10 @@ void RWStepVisual_RWTextLiteral::ReadStep(const Handle(StepData_StepReaderData)&
   if (data->ParamType(num, 5) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 5);
-    if (tpUp.IsEqual(text))
-      aPath = StepVisual_tpUp;
-    else if (tpRight.IsEqual(text))
-      aPath = StepVisual_tpRight;
-    else if (tpDown.IsEqual(text))
-      aPath = StepVisual_tpDown;
-    else if (tpLeft.IsEqual(text))
-      aPath = StepVisual_tpLeft;
-    else
+    if (!RWStepVisual_RWTextPath::ConvertToEnum(text, aPath))
+    {
       ach->AddFail("Enumeration text_path has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #5 (path) is not an enumeration");
@@ -115,21 +105,7 @@ void RWStepVisual_RWTextLiteral::WriteStep(StepData_StepWriter&
 
   // --- own field : path ---
 
-  switch (ent->Path())
-  {
-    case StepVisual_tpUp:
-      SW.SendEnum(tpUp);
-      break;
-    case StepVisual_tpRight:
-      SW.SendEnum(tpRight);
-      break;
-    case StepVisual_tpDown:
-      SW.SendEnum(tpDown);
-      break;
-    case StepVisual_tpLeft:
-      SW.SendEnum(tpLeft);
-      break;
-  }
+  SW.SendEnum(RWStepVisual_RWTextPath::ConvertToString(ent->Path()));
 
   // --- own field : font ---
 
diff --git a/src/DataExchange/TKDESTEP/RWStepVisual/RWStepVisual_RWTextPath.pxx b/src/DataExchange/TKDESTEP/RWStepVisual/RWStepVisual_RWTextPath.pxx
new file mode 100644 (file)
index 0000000..e2d2f4a
--- /dev/null
@@ -0,0 +1,77 @@
+// Copyright (c) 2025 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 _RWStepVisual_RWTextPath_HeaderFile
+#define _RWStepVisual_RWTextPath_HeaderFile
+
+#include <StepVisual_TextPath.hxx>
+#include <Standard_CString.hxx>
+
+namespace RWStepVisual_RWTextPath
+{
+
+static constexpr char tpUp[]    = ".UP.";
+static constexpr char tpRight[] = ".RIGHT.";
+static constexpr char tpDown[]  = ".DOWN.";
+static constexpr char tpLeft[]  = ".LEFT.";
+
+//! Convert StepVisual_TextPath to string
+//! @param theSourceEnum The StepVisual_TextPath value to convert
+//! @return The corresponding string representation or nullptr if not found
+inline const char* ConvertToString(const StepVisual_TextPath theSourceEnum)
+{
+  switch (theSourceEnum)
+  {
+    case StepVisual_tpUp:
+      return tpUp;
+    case StepVisual_tpRight:
+      return tpRight;
+    case StepVisual_tpDown:
+      return tpDown;
+    case StepVisual_tpLeft:
+      return tpLeft;
+  }
+  return nullptr;
+}
+
+//! Convert string to StepVisual_TextPath
+//! @param thePathStr The string to convert
+//! @param theResultEnum The corresponding StepVisual_TextPath value
+//! @return Standard_True if the conversion was successful, Standard_False otherwise
+inline bool ConvertToEnum(const Standard_CString thePathStr, StepVisual_TextPath& theResultEnum)
+{
+  if (IsEqual(thePathStr, tpUp))
+  {
+    theResultEnum = StepVisual_tpUp;
+  }
+  else if (IsEqual(thePathStr, tpRight))
+  {
+    theResultEnum = StepVisual_tpRight;
+  }
+  else if (IsEqual(thePathStr, tpDown))
+  {
+    theResultEnum = StepVisual_tpDown;
+  }
+  else if (IsEqual(thePathStr, tpLeft))
+  {
+    theResultEnum = StepVisual_tpLeft;
+  }
+  else
+  {
+    return Standard_False;
+  }
+  return Standard_True;
+}
+} // namespace RWStepVisual_RWTextPath
+
+#endif // _RWStepVisual_RWTextPath_HeaderFile
index 81aca5da6f7314ad0e42ffd0cea6a50bc8e83b33..49ce77eb4ec752213767c1bdda4fa3f3a239d6e0 100644 (file)
@@ -20,9 +20,7 @@
 #include <StepVisual_ViewVolume.hxx>
 #include <TCollection_AsciiString.hxx>
 
-// --- Enum : CentralOrParallel ---
-static TCollection_AsciiString copCentral(".CENTRAL.");
-static TCollection_AsciiString copParallel(".PARALLEL.");
+#include "RWStepVisual_RWCentralOrParallel.pxx"
 
 RWStepVisual_RWViewVolume::RWStepVisual_RWViewVolume() {}
 
@@ -43,12 +41,10 @@ void RWStepVisual_RWViewVolume::ReadStep(const Handle(StepData_StepReaderData)&
   if (data->ParamType(num, 1) == Interface_ParamEnum)
   {
     Standard_CString text = data->ParamCValue(num, 1);
-    if (copCentral.IsEqual(text))
-      aProjectionType = StepVisual_copCentral;
-    else if (copParallel.IsEqual(text))
-      aProjectionType = StepVisual_copParallel;
-    else
+    if (!RWStepVisual_RWCentralOrParallel::ConvertToEnum(text, aProjectionType))
+    {
       ach->AddFail("Enumeration central_or_parallel has not an allowed value");
+    }
   }
   else
     ach->AddFail("Parameter #1 (projection_type) is not an enumeration");
@@ -125,15 +121,7 @@ void RWStepVisual_RWViewVolume::WriteStep(StepData_StepWriter&                 S
 
   // --- own field : projectionType ---
 
-  switch (ent->ProjectionType())
-  {
-    case StepVisual_copCentral:
-      SW.SendEnum(copCentral);
-      break;
-    case StepVisual_copParallel:
-      SW.SendEnum(copParallel);
-      break;
-  }
+  SW.SendEnum(RWStepVisual_RWCentralOrParallel::ConvertToString(ent->ProjectionType()));
 
   // --- own field : projectionPoint ---