From f13a05375c2478aa155a463356a74ce6bec1befb Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Thu, 3 Apr 2025 14:51:41 +0200
Subject: [PATCH] STYLE: promote ListPolicy to Foam namespace

- previously under Foam::Detail::ListPolicy, now as Foam::ListPolicy
---
 applications/test/List/Make/files                |  2 +-
 .../test/List/{Test-List.C => Test-List.cxx}     |  7 ++-----
 .../containers/Bits/PackedList/PackedList.H      |  4 ++--
 .../containers/Buffers/CircularBufferIO.C        |  2 +-
 .../CompactListList/CompactListList.H            |  2 +-
 .../containers/HashTables/HashSet/HashSet.C      |  2 +-
 .../IndirectListBase/IndirectListBase.H          |  4 ++--
 .../IndirectListBase/IndirectListBaseIO.C        |  2 +-
 .../containers/Lists/FixedList/FixedList.H       |  4 ++--
 .../containers/Lists/FixedList/FixedListIO.C     |  2 +-
 src/OpenFOAM/containers/Lists/List/UList.H       |  4 ++--
 src/OpenFOAM/containers/Lists/List/UListIO.C     |  2 +-
 .../containers/Lists/policy/ListPolicy.H         |  5 +----
 .../expressions/value/exprValueFieldTag.C        | 16 ++++++++--------
 .../expressions/value/exprValueFieldTag.H        |  7 +++----
 src/OpenFOAM/matrices/Matrix/Matrix.H            |  4 ++--
 .../primitives/ranges/labelRange/labelRanges.C   |  2 +-
 17 files changed, 32 insertions(+), 39 deletions(-)
 rename applications/test/List/{Test-List.C => Test-List.cxx} (99%)

diff --git a/applications/test/List/Make/files b/applications/test/List/Make/files
index 35935365d6c..44da0672c1e 100644
--- a/applications/test/List/Make/files
+++ b/applications/test/List/Make/files
@@ -1,3 +1,3 @@
-Test-List.C
+Test-List.cxx
 
 EXE = $(FOAM_USER_APPBIN)/Test-List
diff --git a/applications/test/List/Test-List.C b/applications/test/List/Test-List.cxx
similarity index 99%
rename from applications/test/List/Test-List.C
rename to applications/test/List/Test-List.cxx
index 74b3701e546..9b747a5395e 100644
--- a/applications/test/List/Test-List.C
+++ b/applications/test/List/Test-List.cxx
@@ -75,8 +75,6 @@ public:
 
 
 
-namespace Detail
-{
 namespace ListPolicy
 {
 
@@ -84,7 +82,6 @@ namespace ListPolicy
 template<> struct short_length<short> : std::integral_constant<int,20> {};
 
 } // End namespace ListPolicy
-} // End namespace Detail
 } // End namespace Foam
 
 
@@ -119,9 +116,9 @@ Ostream& printListOutputType(const char* what)
     Info<< what
         << " (contiguous="
         << is_contiguous_v<T> << " no_linebreak="
-        << Detail::ListPolicy::no_linebreak<T>::value
+        << ListPolicy::no_linebreak<T>::value
         << " short_length="
-        << Detail::ListPolicy::short_length<T>::value << ')';
+        << ListPolicy::short_length<T>::value << ')';
 
     return Info;
 }
diff --git a/src/OpenFOAM/containers/Bits/PackedList/PackedList.H b/src/OpenFOAM/containers/Bits/PackedList/PackedList.H
index cc88ba4c38c..b55c7313ca2 100644
--- a/src/OpenFOAM/containers/Bits/PackedList/PackedList.H
+++ b/src/OpenFOAM/containers/Bits/PackedList/PackedList.H
@@ -610,11 +610,11 @@ struct Hash<PackedList<Width>> : PackedList<Width>::hasher {};
 // * * * * * * * * * * * * * * * Global Operators  * * * * * * * * * * * * * //
 
 //- Write List to Ostream, as per UList::writeList() with default length.
-//  The default short-length is given by Detail::ListPolicy::short_length
+//  The default short-length is given by Foam::ListPolicy::short_length
 template<unsigned Width>
 Ostream& operator<<(Ostream& os, const PackedList<Width>& list)
 {
-    return list.writeList(os, Detail::ListPolicy::short_length<void>::value);
+    return list.writeList(os, Foam::ListPolicy::short_length<void>::value);
 }
 
 
diff --git a/src/OpenFOAM/containers/Buffers/CircularBufferIO.C b/src/OpenFOAM/containers/Buffers/CircularBufferIO.C
index 3bb903e4157..18dbe29db5e 100644
--- a/src/OpenFOAM/containers/Buffers/CircularBufferIO.C
+++ b/src/OpenFOAM/containers/Buffers/CircularBufferIO.C
@@ -136,7 +136,7 @@ Foam::Ostream& Foam::CircularBuffer<T>::writeList
      ||
         (
             (len <= shortLen)
-         && (is_contiguous_v<T> || Detail::ListPolicy::no_linebreak<T>::value)
+         && (is_contiguous_v<T> || Foam::ListPolicy::no_linebreak<T>::value)
         )
     )
     {
diff --git a/src/OpenFOAM/containers/CompactLists/CompactListList/CompactListList.H b/src/OpenFOAM/containers/CompactLists/CompactListList/CompactListList.H
index b270f200709..e0a1fb03de0 100644
--- a/src/OpenFOAM/containers/CompactLists/CompactListList/CompactListList.H
+++ b/src/OpenFOAM/containers/CompactLists/CompactListList/CompactListList.H
@@ -542,7 +542,7 @@ Istream& operator>>(Istream& is, CompactListList<T>& list)
 template<class T>
 Ostream& operator<<(Ostream& os, const CompactListList<T>& list)
 {
-    return list.writeList(os, Detail::ListPolicy::short_length<T>::value);
+    return list.writeList(os, Foam::ListPolicy::short_length<T>::value);
 }
 
 
diff --git a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C
index ba4f9298b12..eda9072524e 100644
--- a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C
+++ b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C
@@ -379,7 +379,7 @@ Foam::HashSet<Key, Hash>::operator-=(const HashSet<Key, Hash>& rhs)
 template<class Key, class Hash>
 Foam::Ostream& Foam::operator<<(Ostream& os, const HashSet<Key, Hash>& rhs)
 {
-    return rhs.writeKeys(os, Detail::ListPolicy::short_length<Key>::value);
+    return rhs.writeKeys(os, Foam::ListPolicy::short_length<Key>::value);
 }
 
 
diff --git a/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBase.H b/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBase.H
index 03ea65004c4..e575982af91 100644
--- a/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBase.H
+++ b/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBase.H
@@ -397,11 +397,11 @@ public:
 // * * * * * * * * * * * * * * * IOstream Operators  * * * * * * * * * * * * //
 
 //- Write List to Ostream, as per UList::writeList() with default length.
-//  The default short-length is given by Detail::ListPolicy::short_length
+//  The default short-length is given by Foam::ListPolicy::short_length
 template<class T, class Addr>
 Ostream& operator<<(Ostream& os, const IndirectListBase<T, Addr>& list)
 {
-    return list.writeList(os, Detail::ListPolicy::short_length<T>::value);
+    return list.writeList(os, Foam::ListPolicy::short_length<T>::value);
 }
 
 
diff --git a/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseIO.C b/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseIO.C
index 1978873331c..620cd63ced7 100644
--- a/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseIO.C
+++ b/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseIO.C
@@ -80,7 +80,7 @@ Foam::Ostream& Foam::IndirectListBase<T, Addr>::writeList
      ||
         (
             (len <= shortLen)
-         && (is_contiguous_v<T> || Detail::ListPolicy::no_linebreak<T>::value)
+         && (is_contiguous_v<T> || Foam::ListPolicy::no_linebreak<T>::value)
         )
     )
     {
diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H
index e5db2628209..8d8d818b95a 100644
--- a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H
+++ b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H
@@ -594,11 +594,11 @@ Istream& operator>>(Istream& is, FixedList<T, N>& list)
 
 
 //- Write List to Ostream, as per FixedList::writeList() with default length.
-//  The default short-length is given by Detail::ListPolicy::short_length
+//  The default short-length is given by Foam::ListPolicy::short_length
 template<class T, unsigned N>
 Ostream& operator<<(Ostream& os, const FixedList<T, N>& list)
 {
-    return list.writeList(os, Detail::ListPolicy::short_length<T>::value);
+    return list.writeList(os, Foam::ListPolicy::short_length<T>::value);
 }
 
 
diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C b/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C
index 161498d9a94..7277a5d63fe 100644
--- a/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C
+++ b/src/OpenFOAM/containers/Lists/FixedList/FixedListIO.C
@@ -106,7 +106,7 @@ Foam::Ostream& Foam::FixedList<T, N>::writeList
      ||
         (
             (N <= unsigned(shortLen))
-         && (is_contiguous_v<T> || Detail::ListPolicy::no_linebreak<T>::value)
+         && (is_contiguous_v<T> || Foam::ListPolicy::no_linebreak<T>::value)
         )
     )
     {
diff --git a/src/OpenFOAM/containers/Lists/List/UList.H b/src/OpenFOAM/containers/Lists/List/UList.H
index e027fb35fb3..ede6083323d 100644
--- a/src/OpenFOAM/containers/Lists/List/UList.H
+++ b/src/OpenFOAM/containers/Lists/List/UList.H
@@ -682,11 +682,11 @@ Istream& operator>>(Istream& is, UList<T>& list)
 
 
 //- Write List to Ostream, as per UList::writeList() with default length.
-//  The default short-length is given by Detail::ListPolicy::short_length
+//  The default short-length is given by Foam::ListPolicy::short_length
 template<class T>
 Ostream& operator<<(Ostream& os, const UList<T>& list)
 {
-    return list.writeList(os, Detail::ListPolicy::short_length<T>::value);
+    return list.writeList(os, Foam::ListPolicy::short_length<T>::value);
 }
 
 //- Write std::vector to Ostream. ASCII only, no line-breaks
diff --git a/src/OpenFOAM/containers/Lists/List/UListIO.C b/src/OpenFOAM/containers/Lists/List/UListIO.C
index 1a7ed4385db..bd85943a7f0 100644
--- a/src/OpenFOAM/containers/Lists/List/UListIO.C
+++ b/src/OpenFOAM/containers/Lists/List/UListIO.C
@@ -127,7 +127,7 @@ Foam::Ostream& Foam::UList<T>::writeList
      ||
         (
             (len <= shortLen)
-         && (is_contiguous_v<T> || Detail::ListPolicy::no_linebreak<T>::value)
+         && (is_contiguous_v<T> || Foam::ListPolicy::no_linebreak<T>::value)
         )
     )
     {
diff --git a/src/OpenFOAM/containers/Lists/policy/ListPolicy.H b/src/OpenFOAM/containers/Lists/policy/ListPolicy.H
index 81b3c106b2b..1482c155f94 100644
--- a/src/OpenFOAM/containers/Lists/policy/ListPolicy.H
+++ b/src/OpenFOAM/containers/Lists/policy/ListPolicy.H
@@ -24,7 +24,7 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Namespace
-    Foam::Detail::ListPolicy
+    Foam::ListPolicy
 
 Description
     Additional compile-time controls of List behaviour
@@ -46,8 +46,6 @@ class keyType;
 class word;
 class wordRe;
 
-namespace Detail
-{
 namespace ListPolicy
 {
 
@@ -126,7 +124,6 @@ enum uniformity check_uniformity(InputIt first, InputIt last)
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 } // End namespace ListPolicy
-} // End namespace Detail
 } // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/expressions/value/exprValueFieldTag.C b/src/OpenFOAM/expressions/value/exprValueFieldTag.C
index 0e739b8a869..04286b71267 100644
--- a/src/OpenFOAM/expressions/value/exprValueFieldTag.C
+++ b/src/OpenFOAM/expressions/value/exprValueFieldTag.C
@@ -34,7 +34,7 @@ bool Foam::expressions::exprValueFieldTag::empty() const noexcept
 {
     return
     (
-        uniformity_ == Foam::Detail::ListPolicy::uniformity::EMPTY
+        uniformity_ == Foam::ListPolicy::uniformity::EMPTY
     );
 }
 
@@ -43,7 +43,7 @@ bool Foam::expressions::exprValueFieldTag::is_uniform() const noexcept
 {
     return
     (
-        uniformity_ == Foam::Detail::ListPolicy::uniformity::UNIFORM
+        uniformity_ == Foam::ListPolicy::uniformity::UNIFORM
     );
 }
 
@@ -52,9 +52,9 @@ bool Foam::expressions::exprValueFieldTag::is_nonuniform() const noexcept
 {
     return
     (
-        uniformity_ == Foam::Detail::ListPolicy::uniformity::NONUNIFORM
+        uniformity_ == Foam::ListPolicy::uniformity::NONUNIFORM
         // Extra safety for direct reductions?
-        // || uniformity_ == Foam::Detail::ListPolicy::uniformity::MIXED
+        // || uniformity_ == Foam::ListPolicy::uniformity::MIXED
     );
 }
 
@@ -68,14 +68,14 @@ Foam::expressions::exprValueFieldTag::value() const noexcept
 
 void Foam::expressions::exprValueFieldTag::set_empty()
 {
-    uniformity_ = Foam::Detail::ListPolicy::uniformity::EMPTY;
+    uniformity_ = Foam::ListPolicy::uniformity::EMPTY;
     value_ = Foam::zero{};
 }
 
 
 void Foam::expressions::exprValueFieldTag::set_nouniform()
 {
-    uniformity_ = Foam::Detail::ListPolicy::uniformity::NONUNIFORM;
+    uniformity_ = Foam::ListPolicy::uniformity::NONUNIFORM;
     value_ = Foam::zero{};
 }
 
@@ -145,7 +145,7 @@ void Foam::expressions::exprValueFieldTag::reduce()
     (
         shape == static_cast<bitmask_type>
         (
-            Foam::Detail::ListPolicy::uniformity::EMPTY
+            Foam::ListPolicy::uniformity::EMPTY
         )
     )
     {
@@ -156,7 +156,7 @@ void Foam::expressions::exprValueFieldTag::reduce()
     (
         shape == static_cast<bitmask_type>
         (
-            Foam::Detail::ListPolicy::uniformity::UNIFORM
+            Foam::ListPolicy::uniformity::UNIFORM
         )
     )
     {
diff --git a/src/OpenFOAM/expressions/value/exprValueFieldTag.H b/src/OpenFOAM/expressions/value/exprValueFieldTag.H
index 25f9e29f67b..07f8666e496 100644
--- a/src/OpenFOAM/expressions/value/exprValueFieldTag.H
+++ b/src/OpenFOAM/expressions/value/exprValueFieldTag.H
@@ -57,7 +57,7 @@ class exprValueFieldTag
     // Private Data
 
         //- Uniformity of field (0: empty, 1: uniform, 2: non-uniform, ...)
-        //  Values as per internal enum Foam::Detail::ListPolicy::uniformity
+        //  Values as per internal enum Foam::ListPolicy::uniformity
         int uniformity_{};
 
         //- Representative (uniform) type/value for the field
@@ -134,8 +134,7 @@ public:
         template<class Type>
         void set(const Type* first, const Type* last)
         {
-            uniformity_ =
-                Foam::Detail::ListPolicy::check_uniformity(first, last);
+            uniformity_ = Foam::ListPolicy::check_uniformity(first, last);
 
             if (first != last)  // or uniformity_ != EMPTY
             {
@@ -152,7 +151,7 @@ public:
         template<class Type>
         void set_value(const Type& val)
         {
-            uniformity_ = Foam::Detail::ListPolicy::uniformity::UNIFORM;
+            uniformity_ = Foam::ListPolicy::uniformity::UNIFORM;
             value_.set<Type>(val);
         }
 
diff --git a/src/OpenFOAM/matrices/Matrix/Matrix.H b/src/OpenFOAM/matrices/Matrix/Matrix.H
index 6b9e5cce6fa..e73fa54d66a 100644
--- a/src/OpenFOAM/matrices/Matrix/Matrix.H
+++ b/src/OpenFOAM/matrices/Matrix/Matrix.H
@@ -621,11 +621,11 @@ Istream& operator>>(Istream& is, Matrix<Form, Type>& mat)
 
 
 //- Write Matrix to Ostream, as per Matrix::writeMatrix() with
-//- default length, which is given by Detail::ListPolicy::short_length
+//- default length, which is given by Foam::ListPolicy::short_length
 template<class Form, class Type>
 Ostream& operator<<(Ostream& os, const Matrix<Form, Type>& mat)
 {
-    return mat.writeMatrix(os, Detail::ListPolicy::short_length<Type>::value);
+    return mat.writeMatrix(os, Foam::ListPolicy::short_length<Type>::value);
 }
 
 
diff --git a/src/OpenFOAM/primitives/ranges/labelRange/labelRanges.C b/src/OpenFOAM/primitives/ranges/labelRange/labelRanges.C
index 148e6b02f70..5c19188832b 100644
--- a/src/OpenFOAM/primitives/ranges/labelRange/labelRanges.C
+++ b/src/OpenFOAM/primitives/ranges/labelRange/labelRanges.C
@@ -395,7 +395,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const labelRanges& list)
     return list.writeList
     (
         os,
-        Detail::ListPolicy::short_length<labelRange>::value
+        Foam::ListPolicy::short_length<labelRange>::value
     );
 }
 
-- 
GitLab