]> OCCT Git - occt.git/commitdiff
Foundation Classes, Strings - add EmptyString() for Ascii/Extended and use it everywh...
authorPasukhin Dmitry <dpasukhi@opencascade.com>
Sat, 1 Nov 2025 22:39:12 +0000 (22:39 +0000)
committerGitHub <noreply@github.com>
Sat, 1 Nov 2025 22:39:12 +0000 (22:39 +0000)
Introduce TCollection_AsciiString::EmptyString() and TCollection_ExtendedString::EmptyString()
  and update headers.
Replace many local/static empty string instances and default-constructed
  temporaries with the shared EmptyString() reference across ApplicationFramework, DataExchange,
  Visualization and other modules.
Remove several unused local empty-key/static variables and
  adjust default parameters and return paths to use the centralized empty-string accessors.
Add missing #include <TCollection_AsciiString.hxx> to several headers that use/forward TCollection_AsciiString.

34 files changed:
src/ApplicationFramework/TKLCAF/TDF/TDF_DerivedAttribute.cxx
src/ApplicationFramework/TKLCAF/TDataStd/TDataStd_ExtStringArray.cxx
src/ApplicationFramework/TKStdL/StdLPersistent/StdLPersistent_Collection.cxx
src/ApplicationFramework/TKStdL/StdLPersistent/StdLPersistent_NamedData.cxx
src/DataExchange/TKDESTEP/RWHeaderSection/RWHeaderSection_ReadWriteModule.cxx
src/DataExchange/TKDESTEP/StepData/StepData_EnumTool.cxx
src/DataExchange/TKRWMesh/RWMesh/RWMesh_CafReader.cxx
src/DataExchange/TKXCAF/XCAFPrs/XCAFPrs_DocumentExplorer.cxx
src/DataExchange/TKXSBase/IFSelect/IFSelect_SessionPilot.cxx
src/DataExchange/TKXSBase/MoniTool/MoniTool_CaseData.cxx
src/Draw/TKQADraw/QABugs/QABugs_19.cxx
src/FoundationClasses/TKernel/Message/Message_Attribute.hxx
src/FoundationClasses/TKernel/Message/Message_AttributeMeter.hxx
src/FoundationClasses/TKernel/Message/Message_AttributeObject.hxx
src/FoundationClasses/TKernel/Message/Message_AttributeStream.hxx
src/FoundationClasses/TKernel/Message/Message_Level.hxx
src/FoundationClasses/TKernel/TCollection/TCollection_AsciiString.cxx
src/FoundationClasses/TKernel/TCollection/TCollection_AsciiString.hxx
src/FoundationClasses/TKernel/TCollection/TCollection_ExtendedString.cxx
src/FoundationClasses/TKernel/TCollection/TCollection_ExtendedString.hxx
src/ModelingData/TKBRep/TopoDS/TopoDS_AlertAttribute.hxx
src/Visualization/TKOpenGl/OpenGl/OpenGl_AspectsProgram.cxx
src/Visualization/TKOpenGl/OpenGl/OpenGl_AspectsSprite.cxx
src/Visualization/TKOpenGl/OpenGl/OpenGl_AspectsTextureSet.cxx
src/Visualization/TKOpenGl/OpenGl/OpenGl_FrameBuffer.hxx
src/Visualization/TKOpenGl/OpenGl/OpenGl_Texture.hxx
src/Visualization/TKOpenGl/OpenGl/OpenGl_View.hxx
src/Visualization/TKOpenGl/OpenGl/OpenGl_View_Raytrace.cxx
src/Visualization/TKService/Font/Font_FontMgr.cxx
src/Visualization/TKService/Graphic3d/Graphic3d_AspectText3d.hxx
src/Visualization/TKService/Graphic3d/Graphic3d_ShaderObject.hxx
src/Visualization/TKService/WNT/WNT_WClass.hxx
src/Visualization/TKV3d/PrsDim/PrsDim_AngleDimension.cxx
src/Visualization/TKV3d/PrsDim/PrsDim_Dimension.cxx

index 85f153e9a0d96d2b40a394d8d6e04b22e55d420b..9c12472df14bb5e230b039cf538bd6cd15075375 100644 (file)
@@ -150,8 +150,7 @@ const TCollection_AsciiString& TDF_DerivedAttribute::TypeName(Standard_CString t
     return **aResult;
   }
 
-  static const TCollection_AsciiString anEmpty;
-  return anEmpty;
+  return TCollection_AsciiString::EmptyString();
 }
 
 //=================================================================================================
index 5fc6dc22282ddb3c1398c057347b149fe0351113..489b43921c8214df4ee92ee48f960bc53b261699 100644 (file)
@@ -125,8 +125,7 @@ const TCollection_ExtendedString& TDataStd_ExtStringArray::Value(const Standard_
 {
   if (myValue.IsNull())
   {
-    static TCollection_ExtendedString staticEmptyValue;
-    return staticEmptyValue;
+    return TCollection_ExtendedString::EmptyString();
   }
   return myValue->Value(index);
 }
index 7a1b96654a6dbbe7776db853cf8542ced7e723f2..022c5c584ca01f03a04f4f0fd7df9458b1aa4af8 100644 (file)
@@ -50,12 +50,11 @@ struct StdLPersistent_Collection::stringConverter
 
   const TCollection_ExtendedString& operator()(const Handle(StdObjMgt_Persistent)& theValue) const
   {
-    static TCollection_ExtendedString anEmptyString;
     if (theValue.IsNull())
-      return anEmptyString;
+      return TCollection_ExtendedString::EmptyString();
 
     Handle(TCollection_HExtendedString) aString = theValue->ExtString();
-    return aString ? aString->String() : anEmptyString;
+    return aString ? aString->String() : TCollection_ExtendedString::EmptyString();
   }
 };
 
index f38397e5c2fba232722e05db7e0552954bbd7cca..77631998903b6b61dd07e13ada87df74bbbb2f94 100644 (file)
@@ -25,8 +25,7 @@ static const TCollection_ExtendedString& String(Handle(StdObjMgt_Persistent) the
   if (theValue)
     return theValue->ExtString()->String();
 
-  static TCollection_ExtendedString anEmptyString;
-  return anEmptyString;
+  return TCollection_ExtendedString::EmptyString();
 }
 
 template <class HArray>
index 541770e6d03439d7865a3a69ef63ebe41e4da1c0..05adcc63b24c9c639ceff46c12a88360bc5266a1 100644 (file)
@@ -32,7 +32,7 @@
 IMPLEMENT_STANDARD_RTTIEXT(RWHeaderSection_ReadWriteModule, StepData_ReadWriteModule)
 
 // -- General Declarations (Recognize, StepType) ---
-static TCollection_AsciiString PasReco(""); // neutralise StartEntity de SW
+// neutralise StartEntity de SW
 static TCollection_AsciiString Reco_FileName("FILE_NAME");
 static TCollection_AsciiString Reco_FileDescription("FILE_DESCRIPTION");
 static TCollection_AsciiString Reco_FileSchema("FILE_SCHEMA");
@@ -98,7 +98,7 @@ const TCollection_AsciiString& RWHeaderSection_ReadWriteModule::StepType(
     case 3:
       return Reco_FileSchema;
     default:
-      return PasReco;
+      return TCollection_AsciiString::EmptyString();
   }
 }
 
index 226f8fbd94eefd22b8752bdbd0777b6ee3df93a7..fbe6ea5e8abda89c957faea09265754013d8f3b2 100644 (file)
@@ -14,8 +14,6 @@
 #include <StepData_EnumTool.hxx>
 #include <TCollection_AsciiString.hxx>
 
-static TCollection_AsciiString nulstr("");
-
 StepData_EnumTool::StepData_EnumTool(const Standard_CString e0,
                                      const Standard_CString e1,
                                      const Standard_CString e2,
@@ -176,7 +174,7 @@ Standard_Integer StepData_EnumTool::NullValue() const
 const TCollection_AsciiString& StepData_EnumTool::Text(const Standard_Integer num) const
 {
   if (num < 0 || num >= thetexts.Length())
-    return nulstr;
+    return TCollection_AsciiString::EmptyString();
   return thetexts.Value(num + 1);
 }
 
index 47d805468f2931d161b5ccf2061a2df05411402b..220349ce7f29985417a846dd916cd97417005d46 100644 (file)
@@ -506,8 +506,11 @@ Standard_Boolean RWMesh_CafReader::addSubShapeIntoDoc(CafDocumentTools&   theToo
   theTools.ShapeTool->GetReferredShape(aNewLabel, aNewRefLabel);
 
   // put attributes to the Product (shared across Instances)
-  static const TCollection_AsciiString anEmptyString;
-  setShapeName(aNewRefLabel, aShapeType, aShapeAttribs.Name, TDF_Label(), anEmptyString);
+  setShapeName(aNewRefLabel,
+               aShapeType,
+               aShapeAttribs.Name,
+               TDF_Label(),
+               TCollection_AsciiString::EmptyString());
   setShapeStyle(theTools, aNewRefLabel, aShapeAttribs.Style);
   setShapeNamedData(theTools, aNewRefLabel, aShapeAttribs.NamedData);
 
index 894496c33973c216f05afb0f6e3c6d9fbed70c16..0c228c78d410616cbe1738e7b6ff8dadb9ac0e15 100644 (file)
@@ -303,7 +303,7 @@ void XCAFPrs_DocumentExplorer::initCurrent(Standard_Boolean theIsAssembly)
     myCurrent.Location  = myCurrent.LocalTrsf;
     myCurrent.Style =
       mergedStyle(myColorTool, myVisMatTool, myDefStyle, myCurrent.Label, myCurrent.RefLabel);
-    myCurrent.Id = DefineChildId(myCurrent.Label, TCollection_AsciiString());
+    myCurrent.Id = DefineChildId(myCurrent.Label, TCollection_AsciiString::EmptyString());
   }
   else
   {
@@ -356,7 +356,7 @@ void XCAFPrs_DocumentExplorer::Next()
     aNodeInStack.Location   = aNodeInStack.LocalTrsf;
     aNodeInStack.Style =
       mergedStyle(myColorTool, myVisMatTool, myDefStyle, aNodeInStack.Label, aNodeInStack.RefLabel);
-    aNodeInStack.Id = DefineChildId(aNodeInStack.Label, TCollection_AsciiString());
+    aNodeInStack.Id = DefineChildId(aNodeInStack.Label, TCollection_AsciiString::EmptyString());
     myNodeStack.SetValue(0, aNodeInStack);
     if ((myFlags & XCAFPrs_DocumentExplorerFlags_OnlyLeafNodes) == 0)
     {
index 0d160701c873897713044f26d8d735e70f7788cd..0f710870068fa9c4373fd557bbbd066e44d85ed3 100644 (file)
@@ -31,8 +31,7 @@ IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SessionPilot, IFSelect_Activator)
 #define MAXWORDS 200
 #define MAXCARS 1000
 
-static int                     THE_IFSelect_SessionPilot_initactor = 0;
-static TCollection_AsciiString nulword;
+static int THE_IFSelect_SessionPilot_initactor = 0;
 
 // #define DEBUG_TRACE
 
@@ -217,7 +216,7 @@ const TCollection_AsciiString& IFSelect_SessionPilot::Word(const Standard_Intege
 {
   if (num < thenbwords)
     return thewords(num);
-  return nulword;
+  return TCollection_AsciiString::EmptyString();
 }
 
 Standard_CString IFSelect_SessionPilot::Arg(const Standard_Integer num) const
index 7d0ead76218d09f7bd9ca5866526e56344595345..c74bf03fb4719d7c689a888465641c675ff1e476 100644 (file)
@@ -299,16 +299,10 @@ Standard_Integer MoniTool_CaseData::Kind(const Standard_Integer nd) const
   return thekind(nd);
 }
 
-static const TCollection_AsciiString& nulname()
-{
-  static TCollection_AsciiString nuln;
-  return nuln;
-}
-
 const TCollection_AsciiString& MoniTool_CaseData::Name(const Standard_Integer nd) const
 {
   if (nd < 1 || nd > thednam.Length())
-    return nulname();
+    return TCollection_AsciiString::EmptyString();
   return thednam(nd);
 }
 
index e8b7cd3fba90092d86c374d1a44e89fc9ca6051b..4d5983eac7d0b1dcea393f6d41bccb3120507275 100644 (file)
@@ -880,7 +880,7 @@ static Standard_Integer OCC11758(Draw_Interpretor& di, Standard_Integer n, const
     // assert( d.IsDifferent( a ));
     // assert( d.IsDifferent( h ));
     // assert( !d.IsDifferent( d ));
-    QCOMPARE(d.IsDifferent(TCollection_AsciiString()), Standard_True);
+    QCOMPARE(d.IsDifferent(TCollection_AsciiString::EmptyString()), Standard_True);
     QCOMPARE(d.IsDifferent(a), Standard_True);
     QCOMPARE(d.IsDifferent(h), Standard_True);
     QCOMPARE(!d.IsDifferent(d), Standard_True);
index 4bb5f054ebc00d7f2f2f8ea7bd1c330c13f35044..aee331911c8f5285e24ff048dac9d6004491fac5 100644 (file)
@@ -28,7 +28,7 @@ class Message_Attribute : public Standard_Transient
 public:
   //! Empty constructor
   Standard_EXPORT Message_Attribute(
-    const TCollection_AsciiString& theName = TCollection_AsciiString());
+    const TCollection_AsciiString& theName = TCollection_AsciiString::EmptyString());
 
   //! Return a C string to be used as a key for generating text user messages describing this alert.
   //! The messages are generated with help of Message_Msg class, in Message_Report::Dump().
index eb980eed6b780e16ccce1e65f27f1d0cbf59300b..4d078ec90245c0080d90d053064d8c0dfc64d7c7 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <Message_Attribute.hxx>
 #include <Message_MetricType.hxx>
+#include <TCollection_AsciiString.hxx>
 
 #include <NCollection_IndexedDataMap.hxx>
 
@@ -33,7 +34,7 @@ public:
 public:
   //! Constructor with string argument
   Standard_EXPORT Message_AttributeMeter(
-    const TCollection_AsciiString& theName = TCollection_AsciiString());
+    const TCollection_AsciiString& theName = TCollection_AsciiString::EmptyString());
 
   //! Checks whether the attribute has values for the metric
   //! @param[in] theMetric  metric type
index 644b4cc86201a2d8385f6eadeb526bcf5edfdbb9..5d9bda5a745976170438df8857efbf346d455f95 100644 (file)
@@ -15,6 +15,7 @@
 #define _Message_AttributeObject_HeaderFile
 
 #include <Message_Attribute.hxx>
+#include <TCollection_AsciiString.hxx>
 #include <NCollection_DefineAlloc.hxx>
 
 //! Alert object storing a transient object
@@ -25,7 +26,7 @@ public:
   //! Constructor with string argument
   Standard_EXPORT Message_AttributeObject(
     const Handle(Standard_Transient)& theObject,
-    const TCollection_AsciiString&    theName = TCollection_AsciiString());
+    const TCollection_AsciiString&    theName = TCollection_AsciiString::EmptyString());
 
   //! Returns object
   //! @return the object instance
index fecedb31faff3f389e90ff3815351a508b23d801..55ac0ac2527e614de9c396fd56ed8f4ac6effa4d 100644 (file)
@@ -15,6 +15,7 @@
 #define _Message_AttributeStream_HeaderFile
 
 #include <Message_Attribute.hxx>
+#include <TCollection_AsciiString.hxx>
 
 #include <Standard_SStream.hxx>
 
@@ -26,7 +27,7 @@ public:
   //! Constructor with string argument
   Standard_EXPORT Message_AttributeStream(
     const Standard_SStream&        theStream,
-    const TCollection_AsciiString& theName = TCollection_AsciiString());
+    const TCollection_AsciiString& theName = TCollection_AsciiString::EmptyString());
 
   //! Returns stream value
   const Standard_SStream& Stream() const { return myStream; }
index 1cf3c20b9e41f78f66c17008e5b2367c2c32488f..4eebf3aa7a9189859f5cb9961423b708923eec15 100644 (file)
@@ -18,6 +18,7 @@
 #include <Message_AlertExtended.hxx>
 #include <Message_Gravity.hxx>
 #include <Message_Messenger.hxx>
+#include <TCollection_AsciiString.hxx>
 
 #include <Standard.hxx>
 
@@ -40,7 +41,8 @@ public:
   //! Constructor.
   //! One string key is used for all alert meters.
   //! The perf meter is not started automatically, it will be done in AddAlert() method
-  Standard_EXPORT Message_Level(const TCollection_AsciiString& theName = TCollection_AsciiString());
+  Standard_EXPORT Message_Level(
+    const TCollection_AsciiString& theName = TCollection_AsciiString::EmptyString());
 
   //! Assures stopping upon destruction
   Standard_EXPORT ~Message_Level();
index 87d22802defc355351123e6328e205f7e9d8953e..cb5f15df8992d366fbb52feb7fc9b8fcb20d037c 100644 (file)
@@ -61,7 +61,7 @@ struct FormattedReal
 
 //=================================================================================================
 
-TCollection_AsciiString::TCollection_AsciiString()
+TCollection_AsciiString::TCollection_AsciiString() noexcept
 {
   allocate(0);
 }
@@ -1269,3 +1269,11 @@ Standard_Boolean TCollection_AsciiString::IsSameString(const Standard_CString th
     return Standard_True;
   }
 }
+
+//=================================================================================================
+
+const TCollection_AsciiString& TCollection_AsciiString::EmptyString() noexcept
+{
+  static const TCollection_AsciiString THE_EMPTY_STRING;
+  return THE_EMPTY_STRING;
+}
index 2f6f00ee22acc691f2712504b9c567f4945cb8c9..81d98501f4995fe5a26132433fc82ef2bf4ca48c 100644 (file)
@@ -55,7 +55,7 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! Initializes a AsciiString to an empty AsciiString.
-  Standard_EXPORT TCollection_AsciiString();
+  Standard_EXPORT TCollection_AsciiString() noexcept;
 
 #if Standard_CPP17_OR_HIGHER
   //! Initializes a AsciiString with a string_view.
@@ -1362,6 +1362,19 @@ public:
   //! @return a computed hash code
   inline size_t HashCode() const;
 
+  //! Returns a const reference to a single shared empty string instance.
+  //! This method provides access to a static empty string to avoid creating temporary empty
+  //! strings. Use this method instead of constructing empty strings when you need a const
+  //! reference.
+  //!
+  //! Example:
+  //! ```cpp
+  //! const TCollection_AsciiString& anEmptyStr = TCollection_AsciiString::EmptyString();
+  //! // Use anEmptyStr instead of TCollection_AsciiString()
+  //! ```
+  //! @return const reference to static empty string
+  Standard_EXPORT static const TCollection_AsciiString& EmptyString() noexcept;
+
   //! Returns True  when the two  strings are the same.
   //! (Just for HashCode for AsciiString)
   //! @param[in] string1 first string to compare
index 47ac3b2592a8043d7d760121ae1520decc7ba536..ccb23f519633c6b1425cc73322fa097fa1541c20 100644 (file)
@@ -94,7 +94,7 @@ inline Standard_ExtCharacter* Standard_UNUSED
 
 //=================================================================================================
 
-TCollection_ExtendedString::TCollection_ExtendedString()
+TCollection_ExtendedString::TCollection_ExtendedString() noexcept
 {
   allocate(0);
 }
@@ -950,3 +950,11 @@ void TCollection_ExtendedString::deallocate()
   mylength = 0;
   mystring = THE_DEFAULT_EXT_CHAR_STRING;
 }
+
+//=================================================================================================
+
+const TCollection_ExtendedString& TCollection_ExtendedString::EmptyString() noexcept
+{
+  static const TCollection_ExtendedString THE_EMPTY_STRING;
+  return THE_EMPTY_STRING;
+}
index 5085c4cefe297233e8fbef6c1de0714635c1ef83..cbbb5355a1678a3810b8a631a095de34ca2935b7 100644 (file)
@@ -54,7 +54,7 @@ public:
   DEFINE_STANDARD_ALLOC
 
   //! Initializes a ExtendedString to an empty ExtendedString.
-  Standard_EXPORT TCollection_ExtendedString();
+  Standard_EXPORT TCollection_ExtendedString() noexcept;
 
   //! Creation by converting a CString to an extended
   //! string.  If <isMultiByte> is true then the string is
@@ -350,6 +350,19 @@ public:
     return opencascade::hashBytes(mystring, aSize);
   }
 
+  //! Returns a const reference to a single shared empty string instance.
+  //! This method provides access to a static empty string to avoid creating temporary empty
+  //! strings. Use this method instead of constructing empty strings when you need a const
+  //! reference.
+  //!
+  //! Example:
+  //! ```cpp
+  //! const TCollection_ExtendedString& anEmptyStr = TCollection_ExtendedString::EmptyString();
+  //! // Use anEmptyStr instead of TCollection_ExtendedString()
+  //! ```
+  //! @return const reference to static empty string
+  Standard_EXPORT static const TCollection_ExtendedString& EmptyString() noexcept;
+
   //! Returns true if the characters in this extended
   //! string are identical to the characters in the other extended string.
   //! Note that this method is an alias of operator ==.
index b96e964aa8645c1d4f70e4488d88f3d097120b3d..f3ae1863114933a51cbca4d14566fe5df13afb3d 100644 (file)
@@ -19,6 +19,7 @@
 #include <Message_AttributeStream.hxx>
 #include <Message_Messenger.hxx>
 #include <Message_Report.hxx>
+#include <TCollection_AsciiString.hxx>
 
 #include <TopoDS_Shape.hxx>
 
@@ -32,7 +33,7 @@ public:
   //! Constructor with shape argument
   Standard_EXPORT TopoDS_AlertAttribute(
     const TopoDS_Shape&            theShape,
-    const TCollection_AsciiString& theName = TCollection_AsciiString());
+    const TCollection_AsciiString& theName = TCollection_AsciiString::EmptyString());
 
   //! Returns contained shape
   const TopoDS_Shape& GetShape() const { return myShape; }
index 2026e623a533ae1aa0502b44cba665b3babb9489..b4f1b1654063f972ed252b2ad83f50ecfec304ab 100644 (file)
 #include <OpenGl_ShaderManager.hxx>
 #include <OpenGl_ShaderProgram.hxx>
 
-namespace
-{
-static const TCollection_AsciiString THE_EMPTY_KEY;
-}
-
 //=================================================================================================
 
 void OpenGl_AspectsProgram::Release(OpenGl_Context* theCtx)
@@ -37,8 +32,9 @@ void OpenGl_AspectsProgram::Release(OpenGl_Context* theCtx)
 
 void OpenGl_AspectsProgram::UpdateRediness(const Handle(Graphic3d_Aspects)& theAspect)
 {
-  const TCollection_AsciiString& aShaderKey =
-    theAspect->ShaderProgram().IsNull() ? THE_EMPTY_KEY : theAspect->ShaderProgram()->GetId();
+  const TCollection_AsciiString& aShaderKey = theAspect->ShaderProgram().IsNull()
+                                                ? TCollection_AsciiString::EmptyString()
+                                                : theAspect->ShaderProgram()->GetId();
   if (aShaderKey.IsEmpty() || myShaderProgramId != aShaderKey)
   {
     myIsShaderReady = Standard_False;
index 643c60a600cc92ba52a92f40882b450b66ddc680..7a1c9277b0cf791b279c9dddcf3e9eb71b5fac0c 100644 (file)
 #include <Graphic3d_MarkerImage.hxx>
 #include <TColStd_HArray1OfByte.hxx>
 
-namespace
-{
-static const TCollection_AsciiString THE_EMPTY_KEY;
-}
-
 //=================================================================================================
 
 void OpenGl_AspectsSprite::Release(OpenGl_Context* theCtx)
@@ -98,9 +93,9 @@ void OpenGl_AspectsSprite::UpdateRediness(const Handle(Graphic3d_Aspects)& theAs
              aSpriteKeyNew,
              aSpriteAKeyNew);
   const TCollection_AsciiString& aSpriteKeyOld =
-    !mySprite.IsNull() ? mySprite->ResourceId() : THE_EMPTY_KEY;
+    !mySprite.IsNull() ? mySprite->ResourceId() : TCollection_AsciiString::EmptyString();
   const TCollection_AsciiString& aSpriteAKeyOld =
-    !mySpriteA.IsNull() ? mySpriteA->ResourceId() : THE_EMPTY_KEY;
+    !mySpriteA.IsNull() ? mySpriteA->ResourceId() : TCollection_AsciiString::EmptyString();
   if (aSpriteKeyNew.IsEmpty() || aSpriteKeyOld != aSpriteKeyNew || aSpriteAKeyNew.IsEmpty()
       || aSpriteAKeyOld != aSpriteAKeyNew)
   {
@@ -143,9 +138,9 @@ void OpenGl_AspectsSprite::build(const Handle(OpenGl_Context)&        theCtx,
   spriteKeys(theMarkerImage, theType, theScale, theColor, aNewKey, aNewKeyA);
 
   const TCollection_AsciiString& aSpriteKeyOld =
-    !mySprite.IsNull() ? mySprite->ResourceId() : THE_EMPTY_KEY;
+    !mySprite.IsNull() ? mySprite->ResourceId() : TCollection_AsciiString::EmptyString();
   const TCollection_AsciiString& aSpriteAKeyOld =
-    !mySpriteA.IsNull() ? mySpriteA->ResourceId() : THE_EMPTY_KEY;
+    !mySpriteA.IsNull() ? mySpriteA->ResourceId() : TCollection_AsciiString::EmptyString();
 
   // release old shared resources
   const Standard_Boolean aNewResource = aNewKey.IsEmpty() || aSpriteKeyOld != aNewKey;
index abb41048d30549c7d1ecaa74130e4ea79394e5a9..e2fd475c04828594817ee158d29605376d13d1ce 100644 (file)
 
 #include <Graphic3d_TextureParams.hxx>
 
-namespace
-{
-static const TCollection_AsciiString THE_EMPTY_KEY;
-}
-
 //=================================================================================================
 
 void OpenGl_AspectsTextureSet::Release(OpenGl_Context* theCtx)
index eb8399471c5a5827c11746580ae20556d21f236d..acf7ab6215dd399711257fd82fff15a87913018c 100644 (file)
@@ -16,7 +16,7 @@
 #define OpenGl_FrameBuffer_HeaderFile
 
 #include <OpenGl_NamedResource.hxx>
-
+#include <TCollection_AsciiString.hxx>
 #include <Graphic3d_BufferType.hxx>
 #include <Graphic3d_Vec2.hxx>
 #include <NCollection_Vector.hxx>
@@ -55,7 +55,7 @@ public:
 public:
   //! Empty constructor
   Standard_EXPORT OpenGl_FrameBuffer(
-    const TCollection_AsciiString& theResourceId = TCollection_AsciiString());
+    const TCollection_AsciiString& theResourceId = TCollection_AsciiString::EmptyString());
 
   //! Destructor
   Standard_EXPORT virtual ~OpenGl_FrameBuffer();
index 37caf3fdecea3310ec660e2838070c10d8e7dd2c..bf6df52b421453324b13a205504c41964c6c7fc2 100644 (file)
@@ -22,6 +22,7 @@
 #include <OpenGl_Sampler.hxx>
 #include <Graphic3d_TextureUnit.hxx>
 #include <Graphic3d_TypeOfTexture.hxx>
+#include <TCollection_AsciiString.hxx>
 
 //! Texture resource.
 class OpenGl_Texture : public OpenGl_NamedResource
@@ -39,7 +40,7 @@ public:
 public:
   //! Create uninitialized texture.
   Standard_EXPORT OpenGl_Texture(
-    const TCollection_AsciiString&         theResourceId = TCollection_AsciiString(),
+    const TCollection_AsciiString&         theResourceId = TCollection_AsciiString::EmptyString(),
     const Handle(Graphic3d_TextureParams)& theParams     = Handle(Graphic3d_TextureParams)());
 
   //! Destroy object.
index 146c8d457d11a05ad591b89fcc6f7c2518a98f0e..0ea45a057b2d1a36ae59dcec60b13201bb8b0e20 100644 (file)
@@ -27,6 +27,7 @@
 #include <OpenGl_SceneGeometry.hxx>
 #include <OpenGl_Structure.hxx>
 #include <OpenGl_TileSampler.hxx>
+#include <TCollection_AsciiString.hxx>
 
 #include <map>
 #include <set>
@@ -673,9 +674,6 @@ protected: //! @name data types related to ray-tracing
   class ShaderSource
   {
   public:
-    //! Default shader prefix - empty string.
-    static const TCollection_AsciiString EMPTY_PREFIX;
-
     //! Creates new uninitialized shader source.
     ShaderSource()
     {
@@ -697,12 +695,14 @@ protected: //! @name data types related to ray-tracing
                                    const GLenum                  theType) const;
 
     //! Loads shader source from specified files.
-    Standard_Boolean LoadFromFiles(const TCollection_AsciiString* theFileNames,
-                                   const TCollection_AsciiString& thePrefix = EMPTY_PREFIX);
+    Standard_Boolean LoadFromFiles(
+      const TCollection_AsciiString* theFileNames,
+      const TCollection_AsciiString& thePrefix = TCollection_AsciiString::EmptyString());
 
     //! Loads shader source from specified strings.
-    Standard_Boolean LoadFromStrings(const TCollection_AsciiString* theStrings,
-                                     const TCollection_AsciiString& thePrefix = EMPTY_PREFIX);
+    Standard_Boolean LoadFromStrings(
+      const TCollection_AsciiString* theStrings,
+      const TCollection_AsciiString& thePrefix = TCollection_AsciiString::EmptyString());
 
   private:
     TCollection_AsciiString mySource; //!< Source string of the shader object
index 631e46184242f2a55dc00e188312676b1ed4f24b..fa0776485a37263ebab0a5012411f51853aeb209 100644 (file)
@@ -1056,8 +1056,6 @@ Standard_Boolean OpenGl_View::addRaytracePolygonArray(
   return Standard_True;
 }
 
-const TCollection_AsciiString OpenGl_View::ShaderSource::EMPTY_PREFIX;
-
 // =======================================================================
 // function : Source
 // purpose  : Returns shader source combined with prefix
index 6c85d313f4efefcb996b88f4b40583edc007724b..63c4eb909993f252eeb657d60f420b50f46cd337 100644 (file)
@@ -1087,7 +1087,7 @@ Handle(Font_SystemFont) Font_FontMgr::FindFont(const TCollection_AsciiString& th
   if (aFont.IsNull() && theStrictLevel == Font_StrictLevel_Any)
   {
     // try finding ANY font in case if even default fallback alias myFallbackAlias cannot be found
-    aFont = myFontMap.Find(TCollection_AsciiString());
+    aFont = myFontMap.Find(TCollection_AsciiString::EmptyString());
   }
   if (aFont.IsNull())
   {
index ee5bb0c61490794b94b8c69b3cd8a13e49b028fe..1186f8d4860fd88b4d075bf8e89f3fa1c4ccab21 100644 (file)
@@ -62,8 +62,7 @@ public:
   {
     if (myTextFont.IsNull())
     {
-      static const TCollection_AsciiString anEmpty;
-      return anEmpty;
+      return TCollection_AsciiString::EmptyString();
     }
     return myTextFont->String();
   }
index 05f1ff939cf616dd5c12fe33f53d8a07e7d33a22..9a00fe73e3f05807f73c5d749e9ae31b515f2330 100755 (executable)
@@ -19,6 +19,7 @@
 #include <Graphic3d_TypeOfShaderObject.hxx>
 #include <NCollection_Sequence.hxx>
 #include <OSD_Path.hxx>
+#include <TCollection_AsciiString.hxx>
 
 //! Forward declaration
 
@@ -81,8 +82,8 @@ public:
     Graphic3d_TypeOfShaderObject   theType,
     const ShaderVariableList&      theUniforms,
     const ShaderVariableList&      theStageInOuts,
-    const TCollection_AsciiString& theInName           = TCollection_AsciiString(),
-    const TCollection_AsciiString& theOutName          = TCollection_AsciiString(),
+    const TCollection_AsciiString& theInName           = TCollection_AsciiString::EmptyString(),
+    const TCollection_AsciiString& theOutName          = TCollection_AsciiString::EmptyString(),
     Standard_Integer               theNbGeomInputVerts = 0);
 
 private:
index 03cc72a8fe5076198f5440fb7593d5f48e8d8d11..6481dfb2f17d7681efc04ff5abe801b86446ff8f 100644 (file)
@@ -60,7 +60,7 @@ public:
     const Standard_Integer         theWindowExtra = 0,
     const Aspect_Handle            theCursor      = NULL,
     const Aspect_Handle            theIcon        = NULL,
-    const TCollection_AsciiString& theMenuName    = TCollection_AsciiString());
+    const TCollection_AsciiString& theMenuName    = TCollection_AsciiString::EmptyString());
 
   //! Destroys all resources attached to the class
   Standard_EXPORT ~WNT_WClass();
index e6663853aae46a5403311e705b8832f000302eb2..edcb01b6a7fc1d0aa7475a0c289c89e845e03f13 100644 (file)
@@ -54,10 +54,9 @@ IMPLEMENT_STANDARD_RTTIEXT(PrsDim_AngleDimension, PrsDim_Dimension)
 
 namespace
 {
-static const TCollection_ExtendedString THE_EMPTY_LABEL_STRING;
-static const Standard_Real              THE_EMPTY_LABEL_WIDTH = 0.0;
-static const Standard_ExtCharacter      THE_DEGREE_SYMBOL(0x00B0);
-static const Standard_Real              THE_3D_TEXT_MARGIN = 0.1;
+static const Standard_Real         THE_EMPTY_LABEL_WIDTH = 0.0;
+static const Standard_ExtCharacter THE_DEGREE_SYMBOL(0x00B0);
+static const Standard_Real         THE_3D_TEXT_MARGIN = 0.1;
 
 //! Returns true if the given points lie on a same line.
 static Standard_Boolean isSameLine(const gp_Pnt& theFirstPoint,
@@ -776,7 +775,7 @@ void PrsDim_AngleDimension::Compute(const Handle(PrsMgr_PresentationManager)&,
                     aDimensionAspect->ArrowTailSize(),
                     aFirstArrowEnd,
                     aFirstExtensionDir,
-                    THE_EMPTY_LABEL_STRING,
+                    TCollection_ExtendedString::EmptyString(),
                     THE_EMPTY_LABEL_WIDTH,
                     theMode,
                     LabelPosition_None);
@@ -789,7 +788,7 @@ void PrsDim_AngleDimension::Compute(const Handle(PrsMgr_PresentationManager)&,
                     aDimensionAspect->ArrowTailSize(),
                     aSecondArrowEnd,
                     aSecondExtensionDir,
-                    THE_EMPTY_LABEL_STRING,
+                    TCollection_ExtendedString::EmptyString(),
                     THE_EMPTY_LABEL_WIDTH,
                     theMode,
                     LabelPosition_None);
index bdc880bba32d4aee1f1eddc4fe5d2cb85613e9c0..26de54c89d1c058855e14528d6c25c3878b8992d 100644 (file)
@@ -67,10 +67,6 @@ IMPLEMENT_STANDARD_RTTIEXT(PrsDim_Dimension, AIS_InteractiveObject)
 
 namespace
 {
-// default text strings
-static const TCollection_ExtendedString THE_EMPTY_LABEL;
-static const TCollection_AsciiString    THE_UNDEFINED_UNITS;
-
 // default text margin and resolution
 static const Standard_Real THE_3D_TEXT_MARGIN = 0.1;
 
@@ -218,14 +214,14 @@ void PrsDim_Dimension::SetFlyout(const Standard_Real theFlyout)
 
 const TCollection_AsciiString& PrsDim_Dimension::GetDisplayUnits() const
 {
-  return THE_UNDEFINED_UNITS;
+  return TCollection_AsciiString::EmptyString();
 }
 
 //=================================================================================================
 
 const TCollection_AsciiString& PrsDim_Dimension::GetModelUnits() const
 {
-  return THE_UNDEFINED_UNITS;
+  return TCollection_AsciiString::EmptyString();
 }
 
 //=================================================================================================
@@ -813,7 +809,7 @@ void PrsDim_Dimension::DrawLinearDimension(const Handle(Prs3d_Presentation)& the
                         aDimensionAspect->ArrowTailSize(),
                         aFirstArrowEnd,
                         aFirstExtensionDir,
-                        THE_EMPTY_LABEL,
+                        TCollection_ExtendedString::EmptyString(),
                         0.0,
                         theMode,
                         LabelPosition_None);
@@ -823,7 +819,7 @@ void PrsDim_Dimension::DrawLinearDimension(const Handle(Prs3d_Presentation)& the
                           aDimensionAspect->ArrowTailSize(),
                           aSecondArrowEnd,
                           aSecondExtensionDir,
-                          THE_EMPTY_LABEL,
+                          TCollection_ExtendedString::EmptyString(),
                           0.0,
                           theMode,
                           LabelPosition_None);
@@ -892,7 +888,7 @@ void PrsDim_Dimension::DrawLinearDimension(const Handle(Prs3d_Presentation)& the
                         aDimensionAspect->ArrowTailSize(),
                         aSecondArrowEnd,
                         aSecondExtensionDir,
-                        THE_EMPTY_LABEL,
+                        TCollection_ExtendedString::EmptyString(),
                         0.0,
                         theMode,
                         LabelPosition_None);
@@ -958,7 +954,7 @@ void PrsDim_Dimension::DrawLinearDimension(const Handle(Prs3d_Presentation)& the
                         aDimensionAspect->ArrowTailSize(),
                         aFirstArrowEnd,
                         aFirstExtensionDir,
-                        THE_EMPTY_LABEL,
+                        TCollection_ExtendedString::EmptyString(),
                         0.0,
                         theMode,
                         LabelPosition_None);