modernize C++: use using

This commit is contained in:
wmayer
2023-08-06 19:09:49 +02:00
committed by wwmayer
parent 630554f251
commit dbad96d43e
8 changed files with 41 additions and 16 deletions

View File

@@ -24,10 +24,20 @@
#ifndef APP_DOCUMENTOBSERVERPYTHON_H
#define APP_DOCUMENTOBSERVERPYTHON_H
#include <FCGlobal.h>
#include <boost/signals2.hpp>
#include <CXX/Objects.hxx>
#include <string>
#include <vector>
namespace App
{
class Document;
class DocumentObject;
class ExtensionContainer;
class Property;
/**
* The DocumentObserverPython class is used to notify registered Python instances
* whenever something happens to a document, like creation, destruction, adding or
@@ -111,13 +121,13 @@ private:
Py::Object inst;
static std::vector<DocumentObserverPython*> _instances;
typedef struct PythonObject {
using Connection = struct PythonObject {
boost::signals2::scoped_connection slot;
Py::Object py;
PyObject* ptr() {
return py.ptr();
}
} Connection;
};
Connection pyCreatedDocument;
Connection pyDeletedDocument;

View File

@@ -43,7 +43,7 @@ namespace Data
{
class ElementMap;
typedef std::shared_ptr<ElementMap> ElementMapPtr;
using ElementMapPtr = std::shared_ptr<ElementMap>;
/* This class provides for ComplexGeoData's ability to provide proper naming.
* Specifically, ComplexGeoData uses this class for it's `_id` property.

View File

@@ -45,8 +45,8 @@ using namespace zipios;
// It does not check if the character is valid utf8 or not.
struct cdata_filter {
typedef char char_type;
typedef boost::iostreams::output_filter_tag category;
using char_type = char;
using category = boost::iostreams::output_filter_tag;
template<typename Device>
inline bool put(Device& dev, char c) {

View File

@@ -24,10 +24,23 @@
#ifndef GUI_DOCUMENTOBSERVERPYTHON_H
#define GUI_DOCUMENTOBSERVERPYTHON_H
#include <FCGlobal.h>
#include <boost/signals2.hpp>
#include <CXX/Objects.hxx>
#include <string>
#include <vector>
namespace App {
class Property;
}
namespace Gui
{
class Document;
class ViewProvider;
class ViewProviderDocumentObject;
/**
* The DocumentObserverPython class is used to notify registered Python instances
* whenever something happens to a document, like creation, destruction, adding or
@@ -73,13 +86,13 @@ private:
Py::Object inst;
static std::vector<DocumentObserverPython*> _instances;
typedef struct PythonObject {
using Connection = struct PythonObject {
boost::signals2::scoped_connection slot;
Py::Object py;
PyObject* ptr() {
return py.ptr();
}
} Connection;
};
Connection pyCreatedDocument;
Connection pyDeletedDocument;

View File

@@ -40,7 +40,7 @@ namespace Coin3D {
namespace Quarter {
class SoQTQuarterAdaptor;
typedef void SoQTQuarterAdaptorCB(void* data, SoQTQuarterAdaptor* viewer);
using SoQTQuarterAdaptorCB = void (void* data, SoQTQuarterAdaptor* viewer);
class QUARTER_DLL_API SoQTQuarterAdaptor : public QuarterWidget {

View File

@@ -41,8 +41,10 @@ using SoFCSelectionContextBasePtr = std::shared_ptr<SoFCSelectionContextBase>;
struct GuiExport SoFCSelectionContextBase {
virtual ~SoFCSelectionContextBase() {}
typedef int MergeFunc(int status, SoFCSelectionContextBasePtr &output,
SoFCSelectionContextBasePtr input, SoFCSelectionRoot *node);
using MergeFunc = int (int status,
SoFCSelectionContextBasePtr &output,
SoFCSelectionContextBasePtr input,
SoFCSelectionRoot *node);
};
struct SoFCSelectionContext;

View File

@@ -1030,11 +1030,11 @@ void SoFCSeparator::finish()
// Thread local data for bounding box rendering
//
// The code is inspred by Coin SoLevelOfDetails.cpp.
typedef struct {
using SoFCBBoxRenderInfo = struct {
SoGetBoundingBoxAction * bboxaction;
SoCube *cube;
SoColorPacker *packer;
} SoFCBBoxRenderInfo;
};
static void so_bbox_construct_data(void * closure)
{

View File

@@ -86,22 +86,22 @@ public:
//@}
short mustExecute() const override;
typedef struct {
using ThreadDescription = struct {
const char * designation;
double diameter;
double pitch;
double CoreHole;
} ThreadDescription;
};
static const ThreadDescription threadDescription[][171];
static const double metricHoleDiameters[36][4];
typedef struct {
using UTSClearanceDefinition = struct {
std::string designation;
double close;
double normal;
double loose;
} UTSClearanceDefinition;
};
static const UTSClearanceDefinition UTSHoleDiameters[22];
void Restore(Base::XMLReader & reader) override;