Skip to content

Commit

Permalink
Use C++ 17 compact syntax for Mayo::IO namespace
Browse files Browse the repository at this point in the history
Replacing:
    namespace Mayo {
    namespace IO {
    ...
    } // namespace IO
    } // namespace Mayo

with:
    namespace Mayo::IO {
    ...
    } // namespace Mayo::IO
  • Loading branch information
HuguesDelorme committed Feb 24, 2025
1 parent 84e409d commit 1394b63
Show file tree
Hide file tree
Showing 57 changed files with 119 additions and 236 deletions.
6 changes: 2 additions & 4 deletions src/base/io_format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

#include <algorithm>

namespace Mayo {
namespace IO {
namespace Mayo::IO {

std::string_view formatIdentifier(Format format)
{
Expand Down Expand Up @@ -133,5 +132,4 @@ bool formatProvidesMesh(Format format)
;
}

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/base/io_format.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include "span.h"
#include <string_view>

namespace Mayo {
namespace IO {
namespace Mayo::IO {

// Predefined I/O formats
enum Format {
Expand Down Expand Up @@ -51,5 +50,4 @@ bool formatProvidesBRep(Format format);
// Does 'format' provide mesh model ?
bool formatProvidesMesh(Format format);

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/base/io_parameters_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

namespace Mayo { class PropertyGroup; }

namespace Mayo {
namespace IO {
namespace Mayo::IO {

// Abstract mechanism to provide reader/writer parameters for a format
class ParametersProvider {
Expand All @@ -20,5 +19,4 @@ class ParametersProvider {
virtual const PropertyGroup* findWriterParameters(Format format) const = 0;
};

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/base/io_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

#include "io_reader.h"

namespace Mayo {
namespace IO {
namespace Mayo::IO {

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/base/io_single_format_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include "../base/io_reader.h"
#include "../base/io_writer.h"

namespace Mayo {
namespace IO {
namespace Mayo::IO {

template<Format Fmt, typename FormatReader>
class SingleFormatFactoryReader : public FactoryReader {
Expand Down Expand Up @@ -84,5 +83,4 @@ SingleFormatFactoryWriter<Fmt, FormatWriter>::createProperties(Format format, Pr
return {};
}

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/base/io_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
#include <unordered_set>
#include <vector>

namespace Mayo {
namespace IO {
namespace Mayo::IO {

namespace {

Expand Down Expand Up @@ -665,5 +664,4 @@ void addPredefinedFormatProbes(System* system)
system->addFormatProbe(probeFormat_OFF);
}

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/base/io_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

#include "io_writer.h"

namespace Mayo {
namespace IO {
namespace Mayo::IO {

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/base/occ_static_variables_rollback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#include <iostream>
#include <type_traits>

namespace Mayo {
namespace IO {
namespace Mayo::IO {

struct OccStaticVariablesRollback::Private {
template<typename T>
Expand Down Expand Up @@ -103,5 +102,4 @@ OccStaticVariablesRollback::~OccStaticVariablesRollback()
}
}

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/base/occ_static_variables_rollback.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#include <variant>
#include <vector>

namespace Mayo {
namespace IO {
namespace Mayo::IO {

// Resets an OpenCascade static variable(see Interface_Static) to its previous value on destruction
// It can be used to revert state when an exception is thrown without needing to write
Expand Down Expand Up @@ -52,5 +51,4 @@ class OccStaticVariablesRollback {
std::vector<StaticVariableRecord> m_vecRecord;
};

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
7 changes: 3 additions & 4 deletions src/io_assimp/io_assimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

#include <assimp/version.h>

namespace Mayo {
namespace IO {
namespace Mayo::IO {

Span<const Format> AssimpFactoryReader::formats() const
{
Expand Down Expand Up @@ -98,5 +97,5 @@ std::string_view AssimpLib::strVersionDetails()

return str;
}
} // namespace IO
} // namespace Mayo

} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/io_assimp/io_assimp.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

#include <memory>

namespace Mayo {
namespace IO {
namespace Mayo::IO {

// Provides factory for Assimp-based Reader objects
class AssimpFactoryReader : public FactoryReader {
Expand Down Expand Up @@ -40,5 +39,4 @@ struct AssimpLib {
#endif
};

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/io_assimp/io_assimp_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@

//#define MAYO_ASSIMP_READER_HANDLE_SCALING 1

namespace Mayo {
namespace IO {
namespace Mayo::IO {

namespace {

Expand Down Expand Up @@ -766,5 +765,4 @@ void AssimpReader::transferSceneNode(
this->transferSceneNode(node->mChildren[ichild], targetDoc, labelEntity, fnCallbackMesh);
}

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/io_assimp/io_assimp_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ struct aiMesh;
struct aiNode;
struct aiTexture;

namespace Mayo {
namespace IO {
namespace Mayo::IO {

// Assimp-based reader
// Requires OpenCascade >= v7.5.0(for XCAFDoc_VisMaterial)
Expand Down Expand Up @@ -69,5 +68,4 @@ class AssimpReader : public Reader {
std::unordered_map<std::string, OccHandle<Image_Texture>> m_mapFileTexture;
};

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/io_dxf/aci_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

#include <utility>

namespace Mayo {
namespace IO {
namespace Mayo::IO {

struct RGB_Color {
int r;
Expand Down Expand Up @@ -277,5 +276,4 @@ const std::pair<int, RGB_Color> aciTable[] = {
{ 255, RGB_Color{ 255, 255, 255 } },
};

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/io_dxf/io_dxf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@

#define MAYO_IO_DXF_DEBUG_TRACE 1

namespace Mayo {
namespace IO {
namespace Mayo::IO {

namespace {

Expand Down Expand Up @@ -968,5 +967,4 @@ OccHandle<Geom_BSplineCurve> DxfReader::Internal::createInterpolationSpline(cons
return interp.Curve();
}

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/io_dxf/io_dxf.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
#include <string>
#include <vector>

namespace Mayo {
namespace IO {
namespace Mayo::IO {

// Reader for DXF file format based on FreeCad's CDxfRead
class DxfReader : public Reader {
Expand Down Expand Up @@ -50,5 +49,4 @@ class DxfReader : public Reader {
// Provides factory to create DxfReader objects
class DxfFactoryReader : public SingleFormatFactoryReader<Format_DXF, DxfReader> {};

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/io_gmio/io_gmio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

#include <gmio_core/version.h>

namespace Mayo {
namespace IO {
namespace Mayo::IO {

Span<const Format> GmioFactoryWriter::formats() const
{
Expand Down Expand Up @@ -41,5 +40,4 @@ std::string_view GmioLib::strVersion()
return GMIO_VERSION_STR;
}

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/io_gmio/io_gmio.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@

#include <memory>

namespace Mayo {
namespace IO {
namespace Mayo::IO {

// Provides factory for gmio-based Writer objects
class GmioFactoryWriter : public FactoryWriter {
Expand Down Expand Up @@ -42,5 +41,4 @@ struct GmioLib {
#endif
};

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/io_gmio/io_gmio_amf_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
#include <cmath>
#include <unordered_map>

namespace Mayo {
namespace IO {
namespace Mayo::IO {

namespace {

Expand Down Expand Up @@ -503,5 +502,4 @@ void GmioAmfWriter::amf_getConstellationInstance(
}
}

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
7 changes: 2 additions & 5 deletions src/io_gmio/io_gmio_amf_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
#include <string>
#include <vector>

namespace Mayo {
namespace IO {
namespace Mayo::IO {

// gmio-based writer for AMF format
// Requires gmio >= v0.4.0
Expand Down Expand Up @@ -125,6 +124,4 @@ class GmioAmfWriter : public Writer {
std::vector<Instance> m_vecInstance;
};

} // namespace IO
} // namespace Mayo

} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/io_image/io_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ class GuiApplication;
class GuiDocument;
} // namespace Mayo

namespace Mayo {
namespace IO {
namespace Mayo::IO {

// Provides a writer for image creation
// Formats are those supported by OpenCascade with Image_AlienPixMap, see:
Expand Down Expand Up @@ -81,5 +80,4 @@ class ImageFactoryWriter : public FactoryWriter {
GuiApplication* m_guiApp = nullptr;
};

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/io_occ/io_occ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
# include "io_occ_vrml_reader.h"
#endif

namespace Mayo {
namespace IO {
namespace Mayo::IO {

namespace { using PtrPropertyGroup = std::unique_ptr<PropertyGroup>; }

Expand Down Expand Up @@ -162,5 +161,4 @@ PtrPropertyGroup OccFactoryWriter::createProperties(Format format, PropertyGroup
return {};
}

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/io_occ/io_occ.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include "../base/io_writer.h"
#include "../base/property.h"

namespace Mayo {
namespace IO {
namespace Mayo::IO {

// Provides factory for OpenCascade-based Reader objects
class OccFactoryReader : public FactoryReader {
Expand All @@ -29,5 +28,4 @@ class OccFactoryWriter : public FactoryWriter {
std::unique_ptr<PropertyGroup> createProperties(Format format, PropertyGroup* parentGroup) const override;
};

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
6 changes: 2 additions & 4 deletions src/io_occ/io_occ_base_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
#include <cmath>
#include <fmt/format.h>

namespace Mayo {
namespace IO {
namespace Mayo::IO {

OccBaseMeshReaderProperties::OccBaseMeshReaderProperties(PropertyGroup* parentGroup)
: PropertyGroup(parentGroup),
Expand Down Expand Up @@ -145,5 +144,4 @@ void OccBaseMeshReader::applyParameters()
m_reader.SetSystemCoordinateSystem(this->constParameters().systemCoordinatesConverter);
}

} // namespace IO
} // namespace Mayo
} // namespace Mayo::IO
Loading

0 comments on commit 1394b63

Please sign in to comment.