[Libreoffice-commits] libmspub.git: 8 commits - build/win32 configure.ac .gitignore m4/ax_cxx_compile_stdcxx_11.m4 m4/ax_cxx_compile_stdcxx.m4 m4/.gitignore src/lib
David Tardon
dtardon at redhat.com
Wed Apr 12 17:24:16 UTC 2017
.gitignore | 2
build/win32/libmspub.dsp | 8
build/win32/libmspub.vcproj | 8
build/win32/libmspub.vcxproj | 2
configure.ac | 7
m4/.gitignore | 2
m4/ax_cxx_compile_stdcxx.m4 | 982 +++++++++++++++++++++++++++++++++++++++++
m4/ax_cxx_compile_stdcxx_11.m4 | 39 +
src/lib/MSPUBCollector.cpp | 24 -
src/lib/MSPUBCollector.h | 7
src/lib/MSPUBDocument.cpp | 13
src/lib/MSPUBParser.cpp | 36 -
src/lib/MSPUBParser.h | 4
src/lib/MSPUBParser2k.cpp | 5
src/lib/MSPUBParser97.cpp | 5
src/lib/MSPUBStringVector.cpp | 76 ---
src/lib/PolygonUtils.cpp | 50 +-
src/lib/PolygonUtils.h | 12
src/lib/ShapeGroupElement.cpp | 12
src/lib/ShapeGroupElement.h | 12
src/lib/ShapeInfo.h | 16
21 files changed, 1125 insertions(+), 197 deletions(-)
New commits:
commit 9af2873bc114dd81179c580fa4c5993ddbcc45c5
Author: David Tardon <dtardon at redhat.com>
Date: Wed Apr 12 19:22:46 2017 +0200
drop forgotten source file
Change-Id: I723886aeb318454c40cf6fde77d1bc95fb6ef8a3
diff --git a/build/win32/libmspub.dsp b/build/win32/libmspub.dsp
index 795af8f..e50e13e 100644
--- a/build/win32/libmspub.dsp
+++ b/build/win32/libmspub.dsp
@@ -123,10 +123,6 @@ SOURCE=..\..\src\lib\MSPUBParser97.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\src\lib\MSPUBStringVector.cpp
-# End Source File
-# Begin Source File
-
SOURCE=..\..\src\lib\MSPUBSVGGenerator.cpp
# End Source File
# Begin Source File
@@ -159,10 +155,6 @@ SOURCE=..\..\inc\libmspub\MSPUBDocument.h
# End Source File
# Begin Source File
-SOURCE=..\..\inc\libmspub\MSPUBStringVector.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\src\lib\Arrow.h
# End Source File
# Begin Source File
diff --git a/build/win32/libmspub.vcproj b/build/win32/libmspub.vcproj
index 5b8a581..aa8f955 100644
--- a/build/win32/libmspub.vcproj
+++ b/build/win32/libmspub.vcproj
@@ -209,10 +209,6 @@
>
</File>
<File
- RelativePath="..\..\src\lib\MSPUBStringVector.cpp"
- >
- </File>
- <File
RelativePath="..\..\src\lib\MSPUBSVGGenerator.cpp"
>
</File>
@@ -246,10 +242,6 @@
>
</File>
<File
- RelativePath="..\..\inc\libmspub\MSPUBStringVector.h"
- >
- </File>
- <File
RelativePath="..\..\src\lib\Arrow.h"
>
</File>
diff --git a/build/win32/libmspub.vcxproj b/build/win32/libmspub.vcxproj
index fd24291..3849b77 100644
--- a/build/win32/libmspub.vcxproj
+++ b/build/win32/libmspub.vcxproj
@@ -13,7 +13,6 @@
<ItemGroup>
<ClInclude Include="..\..\inc\libmspub\libmspub.h" />
<ClInclude Include="..\..\inc\libmspub\MSPUBDocument.h" />
- <ClInclude Include="..\..\inc\libmspub\MSPUBStringVector.h" />
<ClInclude Include="..\..\src\lib\Arrow.h" />
<ClInclude Include="..\..\src\lib\BorderArtInfo.h" />
<ClInclude Include="..\..\src\lib\ColorReference.h" />
@@ -61,7 +60,6 @@
<ClCompile Include="..\..\src\lib\MSPUBParser.cpp" />
<ClCompile Include="..\..\src\lib\MSPUBParser2k.cpp" />
<ClCompile Include="..\..\src\lib\MSPUBParser97.cpp" />
- <ClCompile Include="..\..\src\lib\MSPUBStringVector.cpp" />
<ClCompile Include="..\..\src\lib\MSPUBSVGGenerator.cpp" />
<ClCompile Include="..\..\src\lib\PolygonUtils.cpp" />
<ClCompile Include="..\..\src\lib\Shadow.cpp" />
diff --git a/src/lib/MSPUBStringVector.cpp b/src/lib/MSPUBStringVector.cpp
deleted file mode 100644
index 3f1bb75..0000000
--- a/src/lib/MSPUBStringVector.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/*
- * This file is part of the libmspub project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <vector>
-#include <libmspub/libmspub.h>
-
-namespace libmspub
-{
-class MSPUBStringVectorImpl
-{
-public:
- MSPUBStringVectorImpl() : m_strings() {}
- ~MSPUBStringVectorImpl() {}
- std::vector<librevenge::RVNGString> m_strings;
-};
-
-MSPUBStringVector::MSPUBStringVector()
- : m_pImpl(new MSPUBStringVectorImpl())
-{
-}
-
-MSPUBStringVector::MSPUBStringVector(const MSPUBStringVector &vec)
- : m_pImpl(new MSPUBStringVectorImpl(*(vec.m_pImpl)))
-{
-}
-
-MSPUBStringVector::~MSPUBStringVector()
-{
- delete m_pImpl;
-}
-
-MSPUBStringVector &MSPUBStringVector::operator=(const MSPUBStringVector &vec)
-{
- // Check for self-assignment
- if (this == &vec)
- return *this;
- if (m_pImpl)
- delete m_pImpl;
- m_pImpl = new MSPUBStringVectorImpl(*(vec.m_pImpl));
- return *this;
-}
-
-unsigned MSPUBStringVector::size() const
-{
- return (unsigned)(m_pImpl->m_strings.size());
-}
-
-bool MSPUBStringVector::empty() const
-{
- return m_pImpl->m_strings.empty();
-}
-
-const librevenge::RVNGString &MSPUBStringVector::operator[](unsigned idx) const
-{
- return m_pImpl->m_strings[idx];
-}
-
-void MSPUBStringVector::append(const librevenge::RVNGString &str)
-{
- m_pImpl->m_strings.push_back(str);
-}
-
-void MSPUBStringVector::clear()
-{
- m_pImpl->m_strings.clear();
-}
-
-}
-
-/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
commit 1182df1076b8f892a18e3c5bb3a3f3dd6ebce24f
Author: David Tardon <dtardon at redhat.com>
Date: Wed Apr 12 19:17:44 2017 +0200
boost::bind -> std::bind
Change-Id: Id2fe9b3760add82fa7f13cb00ab0bc1ba5ab4afb
diff --git a/configure.ac b/configure.ac
index c963f8e..a83aedd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,7 +95,6 @@ AC_SUBST(ZLIB_LIBS)
# Find required boost headers
# ===========================
AC_CHECK_HEADERS(
- boost/bind.hpp \
boost/numeric/conversion/cast.hpp \
boost/optional.hpp \
boost/ptr_container/ptr_vector.hpp \
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index 39bc9b2..1dd2ce2 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -23,6 +23,8 @@
namespace libmspub
{
+using namespace std::placeholders;
+
namespace
{
@@ -590,7 +592,7 @@ std::function<void(void)> MSPUBCollector::paintShape(const ShapeInfo &info, cons
if (isGroup)
{
m_painter->startLayer(librevenge::RVNGPropertyList());
- return boost::bind(&endShapeGroup, m_painter);
+ return std::bind(&endShapeGroup, m_painter);
}
librevenge::RVNGPropertyList graphicsProps;
if (info.m_fill)
@@ -704,7 +706,7 @@ std::function<void(void)> MSPUBCollector::paintShape(const ShapeInfo &info, cons
writeCustomShape(type, graphicsProps, m_painter, x, y, height, width,
true, foldedTransform,
- std::vector<Line>(), boost::bind(&MSPUBCollector::getCalculationValue, this, info, _1, false, adjustValues), m_paletteColors, info.getCustomShape());
+ std::vector<Line>(), std::bind(&MSPUBCollector::getCalculationValue, this, info, _1, false, adjustValues), m_paletteColors, info.getCustomShape());
if (bool(info.m_pictureRecolor))
{
graphicsProps.remove("draw:color-mode");
@@ -982,7 +984,7 @@ std::function<void(void)> MSPUBCollector::paintShape(const ShapeInfo &info, cons
m_painter->setStyle(graphicsProps);
writeCustomShape(type, graphicsProps, m_painter, x, y, height, width,
false, foldedTransform, lines,
- boost::bind(
+ std::bind(
&MSPUBCollector::getCalculationValue, this, info, _1, false, adjustValues
),
m_paletteColors, info.getCustomShape());
@@ -1617,7 +1619,7 @@ void MSPUBCollector::assignShapesToPages()
for (unsigned i = 0; i < m_topLevelShapes.size(); ++i)
{
unsigned *ptr_pageSeqNum = getIfExists(m_pageSeqNumsByShapeSeqNum, m_topLevelShapes[i].getSeqNum());
- m_topLevelShapes[i].setup(boost::bind(&MSPUBCollector::setupShapeStructures, this, _1));
+ m_topLevelShapes[i].setup(std::bind(&MSPUBCollector::setupShapeStructures, this, _1));
if (ptr_pageSeqNum)
{
PageInfo *ptr_page = getIfExists(m_pagesBySeqNum, *ptr_pageSeqNum);
@@ -1679,7 +1681,7 @@ void MSPUBCollector::writePageShapes(unsigned pageSeqNum) const
for (unsigned i = 0; i < shapeGroupsOrdered.size(); ++i)
{
ShapeGroupElement *shapeGroup = shapeGroupsOrdered[i];
- shapeGroup->visit(boost::bind(&MSPUBCollector::paintShape, this, _1, _2, _3, _4, _5));
+ shapeGroup->visit(std::bind(&MSPUBCollector::paintShape, this, _1, _2, _3, _4, _5));
}
}
diff --git a/src/lib/MSPUBCollector.h b/src/lib/MSPUBCollector.h
index 593657e..b260e6f 100644
--- a/src/lib/MSPUBCollector.h
+++ b/src/lib/MSPUBCollector.h
@@ -19,7 +19,6 @@
#include <algorithm>
#include <boost/ptr_container/ptr_vector.hpp>
-#include <boost/bind.hpp>
#include <librevenge/librevenge.h>
#include <librevenge/librevenge.h>
commit befcab63e585f9f5d47cbef7858c349ae448c99f
Author: David Tardon <dtardon at redhat.com>
Date: Wed Apr 12 19:16:13 2017 +0200
boost::function -> std::function
Change-Id: Iad04fb566ab9de78c329f6feec241e8c7e18fad1
diff --git a/configure.ac b/configure.ac
index 44bfd5a..c963f8e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,7 +96,6 @@ AC_SUBST(ZLIB_LIBS)
# ===========================
AC_CHECK_HEADERS(
boost/bind.hpp \
- boost/function.hpp \
boost/numeric/conversion/cast.hpp \
boost/optional.hpp \
boost/ptr_container/ptr_vector.hpp \
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index 4c9f352..39bc9b2 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -584,7 +584,7 @@ void MSPUBCollector::setupShapeStructures(ShapeGroupElement &elt)
}
-boost::function<void(void)> MSPUBCollector::paintShape(const ShapeInfo &info, const Coordinate &/* relativeTo*/, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform) const
+std::function<void(void)> MSPUBCollector::paintShape(const ShapeInfo &info, const Coordinate &/* relativeTo*/, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform) const
{
std::vector<int> adjustValues = getShapeAdjustValues(info);
if (isGroup)
diff --git a/src/lib/MSPUBCollector.h b/src/lib/MSPUBCollector.h
index c6c659b..593657e 100644
--- a/src/lib/MSPUBCollector.h
+++ b/src/lib/MSPUBCollector.h
@@ -10,6 +10,7 @@
#ifndef __MSPUBCOLLECTOR_H__
#define __MSPUBCOLLECTOR_H__
+#include <functional>
#include <list>
#include <vector>
#include <map>
@@ -19,7 +20,6 @@
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/bind.hpp>
-#include <boost/function.hpp>
#include <librevenge/librevenge.h>
#include <librevenge/librevenge.h>
@@ -192,7 +192,7 @@ private:
boost::optional<Color> oneBitColor) const;
bool pageIsMaster(unsigned pageSeqNum) const;
- boost::function<void(void)> paintShape(const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform) const;
+ std::function<void(void)> paintShape(const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform) const;
double getCalculationValue(const ShapeInfo &info, unsigned index, bool recursiveEntry, const std::vector<int> &adjustValues) const;
librevenge::RVNGPropertyList getCharStyleProps(const CharacterStyle &, boost::optional<unsigned> defaultCharStyleIndex) const;
diff --git a/src/lib/PolygonUtils.cpp b/src/lib/PolygonUtils.cpp
index 035ba19..5a9c3d1 100644
--- a/src/lib/PolygonUtils.cpp
+++ b/src/lib/PolygonUtils.cpp
@@ -5674,13 +5674,13 @@ ShapeElementCommand getCommandFromBinary(unsigned short binary)
return ShapeElementCommand(cmd, count);
}
-double getSpecialIfNecessary(boost::function<double(unsigned index)> calculator, int val)
+double getSpecialIfNecessary(std::function<double(unsigned index)> calculator, int val)
{
bool special = val & 0x80000000;
return special ? calculator(val ^ 0x80000000) : val;
}
-Coordinate CustomShape::getTextRectangle(double x, double y, double width, double height, boost::function<double(unsigned index)> calculator) const
+Coordinate CustomShape::getTextRectangle(double x, double y, double width, double height, std::function<double(unsigned index)> calculator) const
{
double scaleX = width * m_coordWidth;
double scaleY = height * m_coordHeight;
@@ -5729,7 +5729,7 @@ void drawEmulatedLine(std::shared_ptr<const CustomShape> shape, ShapeType shapeT
Vector2D center, VectorTransformation2D transform,
double x, double y, double scaleX, double scaleY,
bool drawStroke, librevenge::RVNGPropertyList &graphicsProps, librevenge::RVNGDrawingInterface *painter,
- boost::function<double(unsigned index)> calculator,
+ std::function<double(unsigned index)> calculator,
const std::vector<Color> &palette)
{
std::vector<LineInfo> lineInfos;
@@ -5905,7 +5905,7 @@ librevenge::RVNGPropertyList calcClipPath(const std::vector<Vertex> &verts, doub
return vertices;
}
-void writeCustomShape(ShapeType shapeType, librevenge::RVNGPropertyList &graphicsProps, librevenge::RVNGDrawingInterface *painter, double x, double y, double height, double width, bool closeEverything, VectorTransformation2D transform, std::vector<Line> lines, boost::function<double(unsigned index)> calculator, const std::vector<Color> &palette, std::shared_ptr<const CustomShape> shape)
+void writeCustomShape(ShapeType shapeType, librevenge::RVNGPropertyList &graphicsProps, librevenge::RVNGDrawingInterface *painter, double x, double y, double height, double width, bool closeEverything, VectorTransformation2D transform, std::vector<Line> lines, std::function<double(unsigned index)> calculator, const std::vector<Color> &palette, std::shared_ptr<const CustomShape> shape)
{
MSPUB_DEBUG_MSG(("***STARTING CUSTOM SHAPE***\n"));
if (!shape)
diff --git a/src/lib/PolygonUtils.h b/src/lib/PolygonUtils.h
index ede0213..9750668 100644
--- a/src/lib/PolygonUtils.h
+++ b/src/lib/PolygonUtils.h
@@ -10,11 +10,11 @@
#ifndef __POLYGONUTILS_H__
#define __POLYGONUTILS_H__
+#include <functional>
#include <memory>
#include <vector>
#include <librevenge/librevenge.h>
-#include <boost/function.hpp>
#include "ShapeType.h"
#include "VectorTransformation2D.h"
@@ -73,7 +73,7 @@ struct CustomShape
unsigned m_numGluePoints;
unsigned char m_adjustShiftMask;
- Coordinate getTextRectangle(double x, double y, double width, double height, boost::function<double(unsigned index)> calculator) const;
+ Coordinate getTextRectangle(double x, double y, double width, double height, std::function<double(unsigned index)> calculator) const;
CustomShape(const Vertex *p_vertices, unsigned numVertices, const unsigned short *p_elements, unsigned numElements, const Calculation *p_calculations, unsigned numCalculations, const int *p_defaultAdjustValues, unsigned numDefaultAdjustValues, const TextRectangle *p_textRectangles, unsigned numTextRectangles, unsigned coordWidth, unsigned coordHeight, const Vertex *p_gluePoints, unsigned numGluePoints, unsigned char adjustShiftMask = 0) :
mp_vertices(p_vertices), m_numVertices(numVertices),
@@ -115,7 +115,7 @@ std::shared_ptr<const CustomShape> getFromDynamicCustomShape(const DynamicCustom
const CustomShape *getCustomShape(ShapeType type);
bool isShapeTypeRectangle(ShapeType type);
librevenge::RVNGPropertyList calcClipPath(const std::vector<libmspub::Vertex> &verts, double x, double y, double height, double width, VectorTransformation2D transform, std::shared_ptr<const CustomShape> shape);
-void writeCustomShape(ShapeType shapeType, librevenge::RVNGPropertyList &graphicsProps, librevenge::RVNGDrawingInterface *painter, double x, double y, double height, double width, bool closeEverything, VectorTransformation2D transform, std::vector<Line> lines, boost::function<double(unsigned index)> calculator, const std::vector<Color> &palette, std::shared_ptr<const CustomShape> shape);
+void writeCustomShape(ShapeType shapeType, librevenge::RVNGPropertyList &graphicsProps, librevenge::RVNGDrawingInterface *painter, double x, double y, double height, double width, bool closeEverything, VectorTransformation2D transform, std::vector<Line> lines, std::function<double(unsigned index)> calculator, const std::vector<Color> &palette, std::shared_ptr<const CustomShape> shape);
} // libmspub
#endif /* __POLYGONUTILS_H__ */
diff --git a/src/lib/ShapeGroupElement.cpp b/src/lib/ShapeGroupElement.cpp
index c828eb7..529156b 100644
--- a/src/lib/ShapeGroupElement.cpp
+++ b/src/lib/ShapeGroupElement.cpp
@@ -46,7 +46,7 @@ void ShapeGroupElement::setTransform(const VectorTransformation2D &transform)
m_transform = transform;
}
-void ShapeGroupElement::setup(boost::function<void(ShapeGroupElement &self)> visitor)
+void ShapeGroupElement::setup(std::function<void(ShapeGroupElement &self)> visitor)
{
visitor(*this);
for (unsigned i = 0; i < m_children.size(); ++i)
@@ -55,8 +55,8 @@ void ShapeGroupElement::setup(boost::function<void(ShapeGroupElement &self)> vis
}
}
-void ShapeGroupElement::visit(boost::function<
- boost::function<void(void)>
+void ShapeGroupElement::visit(std::function<
+ std::function<void(void)>
(const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform)
> visitor, const Coordinate &relativeTo, const VectorTransformation2D &parentFoldedTransform) const
{
@@ -70,7 +70,7 @@ void ShapeGroupElement::visit(boost::function<
double offsetY = centerY - relativeCenterY;
VectorTransformation2D foldedTransform = VectorTransformation2D::fromTranslate(-offsetX, -offsetY)
* parentFoldedTransform * VectorTransformation2D::fromTranslate(offsetX, offsetY) * m_transform;
- boost::function<void(void)> afterOp = visitor(info, relativeTo, foldedTransform, isGroup(), m_transform);
+ std::function<void(void)> afterOp = visitor(info, relativeTo, foldedTransform, isGroup(), m_transform);
for (unsigned i = 0; i < m_children.size(); ++i)
{
m_children[i]->visit(visitor, coord, foldedTransform);
@@ -78,8 +78,8 @@ void ShapeGroupElement::visit(boost::function<
afterOp();
}
-void ShapeGroupElement::visit(boost::function<
- boost::function<void(void)>
+void ShapeGroupElement::visit(std::function<
+ std::function<void(void)>
(const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform)
> visitor) const
{
diff --git a/src/lib/ShapeGroupElement.h b/src/lib/ShapeGroupElement.h
index 75c1ad5..86ea888 100644
--- a/src/lib/ShapeGroupElement.h
+++ b/src/lib/ShapeGroupElement.h
@@ -10,7 +10,7 @@
#ifndef __SHAPEGROUPELEMENT_H__
#define __SHAPEGROUPELEMENT_H__
#include <boost/optional.hpp>
-#include <boost/function.hpp>
+#include <functional>
#include <vector>
#include "ShapeInfo.h"
@@ -32,13 +32,13 @@ public:
ShapeGroupElement(ShapeGroupElement *parent, unsigned seqNum);
~ShapeGroupElement();
void setShapeInfo(const ShapeInfo &shapeInfo);
- void setup(boost::function<void(ShapeGroupElement &self)> visitor);
- void visit(boost::function<
- boost::function<void(void)>
+ void setup(std::function<void(ShapeGroupElement &self)> visitor);
+ void visit(std::function<
+ std::function<void(void)>
(const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform)> visitor,
const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform) const;
- void visit(boost::function<
- boost::function<void(void)>
+ void visit(std::function<
+ std::function<void(void)>
(const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform)> visitor) const;
bool isGroup() const;
ShapeGroupElement *getParent();
diff --git a/src/lib/ShapeInfo.h b/src/lib/ShapeInfo.h
index f175150..eee7974 100644
--- a/src/lib/ShapeInfo.h
+++ b/src/lib/ShapeInfo.h
@@ -10,10 +10,10 @@
#ifndef __SHAPEINFO_H__
#define __SHAPEINFO_H__
#include <boost/optional.hpp>
+#include <functional>
#include <map>
#include <memory>
#include <vector>
-#include <boost/function.hpp>
#include "ShapeType.h"
#include "Coordinate.h"
#include "Line.h"
@@ -85,11 +85,11 @@ struct ShapeInfo
{
return std::shared_ptr<const CustomShape>(
libmspub::getCustomShape(m_cropType.get()),
- boost::function<void (const CustomShape *)>(noop));
+ std::function<void (const CustomShape *)>(noop));
}
return std::shared_ptr<const CustomShape>(
libmspub::getCustomShape(m_type.get_value_or(RECTANGLE)),
- boost::function<void (const CustomShape *)>(noop));
+ std::function<void (const CustomShape *)>(noop));
}
};
}
commit de08cfc104f269a53983cbaf56e55d272bc94047
Author: David Tardon <dtardon at redhat.com>
Date: Wed Apr 12 19:12:10 2017 +0200
boost::shared_ptr -> std::shared_ptr
Change-Id: I6398764b34b3b2d52bbd2251d7945f0d0341423e
diff --git a/configure.ac b/configure.ac
index 90bc39f..44bfd5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,7 +100,7 @@ AC_CHECK_HEADERS(
boost/numeric/conversion/cast.hpp \
boost/optional.hpp \
boost/ptr_container/ptr_vector.hpp \
- boost/shared_ptr.hpp,
+ ,
[],
[AC_MSG_ERROR(Required boost headers not found. Install boost)],
[]
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index 90b6725..4c9f352 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -520,7 +520,7 @@ void endShapeGroup(librevenge::RVNGDrawingInterface *painter)
std::vector<int> MSPUBCollector::getShapeAdjustValues(const ShapeInfo &info) const
{
std::vector<int> ret;
- boost::shared_ptr<const CustomShape> ptr_shape = info.getCustomShape();
+ std::shared_ptr<const CustomShape> ptr_shape = info.getCustomShape();
if (ptr_shape)
{
for (unsigned i = 0; i < ptr_shape->m_numDefaultAdjustValues; ++i)
@@ -569,7 +569,7 @@ void MSPUBCollector::setupShapeStructures(ShapeGroupElement &elt)
rot = ptr_info->m_innerRotation.get();
if (index - 1 < m_images.size())
{
- ptr_info->m_fill = boost::shared_ptr<const Fill>(new ImgFill(index, this, false, rot));
+ ptr_info->m_fill = std::shared_ptr<const Fill>(new ImgFill(index, this, false, rot));
}
}
elt.setShapeInfo(*ptr_info);
@@ -1275,7 +1275,7 @@ double MSPUBCollector::getSpecialValue(const ShapeInfo &info, const CustomShape
double MSPUBCollector::getCalculationValue(const ShapeInfo &info, unsigned index, bool recursiveEntry, const std::vector<int> &adjustValues) const
{
- boost::shared_ptr<const CustomShape> p_shape = info.getCustomShape();
+ std::shared_ptr<const CustomShape> p_shape = info.getCustomShape();
if (! p_shape)
{
return 0;
@@ -1415,7 +1415,7 @@ void MSPUBCollector::setShapeDash(unsigned seqNum, const Dash &dash)
m_shapeInfosBySeqNum[seqNum].m_dash = dash;
}
-void MSPUBCollector::setShapeFill(unsigned seqNum, boost::shared_ptr<Fill> fill, bool skipIfNotBg)
+void MSPUBCollector::setShapeFill(unsigned seqNum, std::shared_ptr<Fill> fill, bool skipIfNotBg)
{
m_shapeInfosBySeqNum[seqNum].m_fill = fill;
if (skipIfNotBg)
@@ -1688,7 +1688,7 @@ void MSPUBCollector::writePageBackground(unsigned pageSeqNum) const
const unsigned *ptr_fillSeqNum = getIfExists_const(m_bgShapeSeqNumsByPageSeqNum, pageSeqNum);
if (ptr_fillSeqNum)
{
- boost::shared_ptr<const Fill> ptr_fill;
+ std::shared_ptr<const Fill> ptr_fill;
const ShapeInfo *ptr_info = getIfExists_const(m_shapeInfosBySeqNum, *ptr_fillSeqNum);
if (ptr_info)
{
diff --git a/src/lib/MSPUBCollector.h b/src/lib/MSPUBCollector.h
index 5d96c05..c6c659b 100644
--- a/src/lib/MSPUBCollector.h
+++ b/src/lib/MSPUBCollector.h
@@ -78,7 +78,7 @@ public:
void setShapeBorderImageId(unsigned seqNum, unsigned borderImageId);
void setShapeCoordinatesInEmu(unsigned seqNum, int xs, int ys, int xe, int ye);
void setShapeImgIndex(unsigned seqNum, unsigned index);
- void setShapeFill(unsigned seqNum, boost::shared_ptr<Fill> fill, bool skipIfNotBg);
+ void setShapeFill(unsigned seqNum, std::shared_ptr<Fill> fill, bool skipIfNotBg);
void setShapeDash(unsigned seqNum, const Dash &dash);
void setAdjustValue(unsigned seqNum, unsigned index, int adjust);
void setShapeRotation(unsigned seqNum, double rotation);
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 4712e03..bfa7450 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -1639,7 +1639,7 @@ void MSPUBParser::parseEscherShape(librevenge::RVNGInputStream *input, const Esc
bool useLine = lineExistsByFlagPointer(
ptr_lineFlags, ptr_geomFlags);
bool skipIfNotBg = false;
- boost::shared_ptr<Fill> ptr_fill = getNewFill(foptValues.m_scalarValues, skipIfNotBg, foptValues.m_complexValues);
+ std::shared_ptr<Fill> ptr_fill = getNewFill(foptValues.m_scalarValues, skipIfNotBg, foptValues.m_complexValues);
unsigned lineWidth = 0;
if (useLine)
{
@@ -1916,8 +1916,8 @@ void MSPUBParser::parseEscherShape(librevenge::RVNGInputStream *input, const Esc
}
}
-boost::shared_ptr<Fill> MSPUBParser::getNewFill(const std::map<unsigned short, unsigned> &foptProperties,
- bool &skipIfNotBg, std::map<unsigned short, std::vector<unsigned char> > &foptValues)
+std::shared_ptr<Fill> MSPUBParser::getNewFill(const std::map<unsigned short, unsigned> &foptProperties,
+ bool &skipIfNotBg, std::map<unsigned short, std::vector<unsigned char> > &foptValues)
{
const FillType *ptr_fillType = (FillType *)getIfExists_const(foptProperties, FIELDID_FILL_TYPE);
FillType fillType = ptr_fillType ? *ptr_fillType : SOLID;
@@ -1931,9 +1931,9 @@ boost::shared_ptr<Fill> MSPUBParser::getNewFill(const std::map<unsigned short, u
if (ptr_fillColor && !skipIfNotBg)
{
const unsigned *ptr_fillOpacity = getIfExists_const(foptProperties, FIELDID_FILL_OPACITY);
- return boost::shared_ptr<Fill>(new SolidFill(ColorReference(*ptr_fillColor), ptr_fillOpacity ? (double)(*ptr_fillOpacity) / 0xFFFF : 1, m_collector));
+ return std::shared_ptr<Fill>(new SolidFill(ColorReference(*ptr_fillColor), ptr_fillOpacity ? (double)(*ptr_fillOpacity) / 0xFFFF : 1, m_collector));
}
- return boost::shared_ptr<Fill>();
+ return std::shared_ptr<Fill>();
}
case SHADE_SHAPE:
case SHADE_CENTER:
@@ -1985,7 +1985,7 @@ boost::shared_ptr<Fill> MSPUBParser::getNewFill(const std::map<unsigned short, u
if (ptr_fillBottom)
fillBottomVal = toFixedPoint(*ptr_fillBottom);
- boost::shared_ptr<GradientFill> ret(new GradientFill(m_collector, angle, (int)fillType));
+ std::shared_ptr<GradientFill> ret(new GradientFill(m_collector, angle, (int)fillType));
ret->setFillCenter(fillLeftVal, fillTopVal, fillRightVal, fillBottomVal);
const unsigned *ptr_fillGrad = getIfExists_const(foptProperties, FIELDID_FILL_SHADE_COMPLEX);
@@ -2062,9 +2062,9 @@ boost::shared_ptr<Fill> MSPUBParser::getNewFill(const std::map<unsigned short, u
const unsigned *ptr_bgPxId = getIfExists_const(foptProperties, FIELDID_BG_PXID);
if (ptr_bgPxId && *ptr_bgPxId > 0 && *ptr_bgPxId <= m_escherDelayIndices.size() && m_escherDelayIndices[*ptr_bgPxId - 1] >= 0)
{
- return boost::shared_ptr<Fill>(new ImgFill(m_escherDelayIndices[*ptr_bgPxId - 1], m_collector, fillType == TEXTURE, rotation));
+ return std::shared_ptr<Fill>(new ImgFill(m_escherDelayIndices[*ptr_bgPxId - 1], m_collector, fillType == TEXTURE, rotation));
}
- return boost::shared_ptr<Fill>();
+ return std::shared_ptr<Fill>();
}
case PATTERN:
{
@@ -2076,13 +2076,13 @@ boost::shared_ptr<Fill> MSPUBParser::getNewFill(const std::map<unsigned short, u
ColorReference back = ptr_fillBackColor ? ColorReference(*ptr_fillBackColor) : ColorReference(0x00FFFFFF);
if (ptr_bgPxId && *ptr_bgPxId > 0 && *ptr_bgPxId <= m_escherDelayIndices.size() && m_escherDelayIndices[*ptr_bgPxId - 1] >= 0)
{
- return boost::shared_ptr<Fill>(new PatternFill(m_escherDelayIndices[*ptr_bgPxId - 1], m_collector, fill, back));
+ return std::shared_ptr<Fill>(new PatternFill(m_escherDelayIndices[*ptr_bgPxId - 1], m_collector, fill, back));
}
- return boost::shared_ptr<Fill>();
+ return std::shared_ptr<Fill>();
}
case BACKGROUND:
default:
- return boost::shared_ptr<Fill>();
+ return std::shared_ptr<Fill>();
}
}
diff --git a/src/lib/MSPUBParser.h b/src/lib/MSPUBParser.h
index e1edad2..5adcbf7 100644
--- a/src/lib/MSPUBParser.h
+++ b/src/lib/MSPUBParser.h
@@ -11,11 +11,11 @@
#define __MSPUBPARSER_H__
#include <map>
+#include <memory>
#include <set>
#include <vector>
#include <memory>
-#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
#include <librevenge/librevenge.h>
@@ -141,7 +141,7 @@ protected:
unsigned getFontIndex(librevenge::RVNGInputStream *input, const MSPUBBlockInfo &info);
CharacterStyle getCharacterStyle(librevenge::RVNGInputStream *input);
ParagraphStyle getParagraphStyle(librevenge::RVNGInputStream *input);
- boost::shared_ptr<Fill> getNewFill(const std::map<unsigned short, unsigned> &foptValues, bool &skipIfNotBg, std::map<unsigned short, std::vector<unsigned char> > &foptVal);
+ std::shared_ptr<Fill> getNewFill(const std::map<unsigned short, unsigned> &foptValues, bool &skipIfNotBg, std::map<unsigned short, std::vector<unsigned char> > &foptVal);
librevenge::RVNGInputStream *m_input;
unsigned m_length;
diff --git a/src/lib/MSPUBParser2k.cpp b/src/lib/MSPUBParser2k.cpp
index c0c7413..e68bd93 100644
--- a/src/lib/MSPUBParser2k.cpp
+++ b/src/lib/MSPUBParser2k.cpp
@@ -8,8 +8,7 @@
*/
#include <algorithm>
-
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <librevenge-stream/librevenge-stream.h>
@@ -586,7 +585,7 @@ void MSPUBParser2k::parseShapeFill(librevenge::RVNGInputStream *input, unsigned
input->seek(chunkOffset + getShapeFillColorOffset(), librevenge::RVNG_SEEK_SET);
unsigned fillColorReference = readU32(input);
unsigned translatedFillColorReference = translate2kColorReference(fillColorReference);
- m_collector->setShapeFill(seqNum, boost::shared_ptr<Fill>(new SolidFill(ColorReference(translatedFillColorReference), 1, m_collector)), false);
+ m_collector->setShapeFill(seqNum, std::shared_ptr<Fill>(new SolidFill(ColorReference(translatedFillColorReference), 1, m_collector)), false);
}
}
diff --git a/src/lib/PolygonUtils.cpp b/src/lib/PolygonUtils.cpp
index 5ea0c3f..035ba19 100644
--- a/src/lib/PolygonUtils.cpp
+++ b/src/lib/PolygonUtils.cpp
@@ -5725,7 +5725,7 @@ private:
}
-void drawEmulatedLine(boost::shared_ptr<const CustomShape> shape, ShapeType shapeType, const std::vector<Line> &lines,
+void drawEmulatedLine(std::shared_ptr<const CustomShape> shape, ShapeType shapeType, const std::vector<Line> &lines,
Vector2D center, VectorTransformation2D transform,
double x, double y, double scaleX, double scaleY,
bool drawStroke, librevenge::RVNGPropertyList &graphicsProps, librevenge::RVNGDrawingInterface *painter,
@@ -5880,7 +5880,7 @@ void getRayEllipseIntersection(double initX, double initY, double rx, double ry,
yOut += cy;
}
-librevenge::RVNGPropertyList calcClipPath(const std::vector<Vertex> &verts, double x, double y, double height, double width, VectorTransformation2D transform, boost::shared_ptr<const CustomShape> shape)
+librevenge::RVNGPropertyList calcClipPath(const std::vector<Vertex> &verts, double x, double y, double height, double width, VectorTransformation2D transform, std::shared_ptr<const CustomShape> shape)
{
librevenge::RVNGPropertyList vertices;
Vector2D center(x + width / 2, y + height / 2);
@@ -5905,7 +5905,7 @@ librevenge::RVNGPropertyList calcClipPath(const std::vector<Vertex> &verts, doub
return vertices;
}
-void writeCustomShape(ShapeType shapeType, librevenge::RVNGPropertyList &graphicsProps, librevenge::RVNGDrawingInterface *painter, double x, double y, double height, double width, bool closeEverything, VectorTransformation2D transform, std::vector<Line> lines, boost::function<double(unsigned index)> calculator, const std::vector<Color> &palette, boost::shared_ptr<const CustomShape> shape)
+void writeCustomShape(ShapeType shapeType, librevenge::RVNGPropertyList &graphicsProps, librevenge::RVNGDrawingInterface *painter, double x, double y, double height, double width, bool closeEverything, VectorTransformation2D transform, std::vector<Line> lines, boost::function<double(unsigned index)> calculator, const std::vector<Color> &palette, std::shared_ptr<const CustomShape> shape)
{
MSPUB_DEBUG_MSG(("***STARTING CUSTOM SHAPE***\n"));
if (!shape)
@@ -6378,25 +6378,25 @@ bool isShapeTypeRectangle(ShapeType type)
}
-boost::shared_ptr<const CustomShape> getFromDynamicCustomShape(const DynamicCustomShape &dcs)
-{
- return boost::shared_ptr<const CustomShape>(new CustomShape(
- dcs.m_vertices.empty() ? NULL : &dcs.m_vertices[0],
- dcs.m_vertices.size(),
- dcs.m_elements.empty() ? NULL : &dcs.m_elements[0],
- dcs.m_elements.size(),
- dcs.m_calculations.empty() ? NULL : &dcs.m_calculations[0],
- dcs.m_calculations.size(),
- dcs.m_defaultAdjustValues.empty() ? NULL :
- &dcs.m_defaultAdjustValues[0],
- dcs.m_defaultAdjustValues.size(),
- dcs.m_textRectangles.empty() ? NULL : &dcs.m_textRectangles[0],
- dcs.m_textRectangles.size(),
- dcs.m_coordWidth, dcs.m_coordHeight,
- dcs.m_gluePoints.empty() ? NULL : &dcs.m_gluePoints[0],
- dcs.m_gluePoints.size(),
- dcs.m_adjustShiftMask
- ));
+std::shared_ptr<const CustomShape> getFromDynamicCustomShape(const DynamicCustomShape &dcs)
+{
+ return std::shared_ptr<const CustomShape>(new CustomShape(
+ dcs.m_vertices.empty() ? NULL : &dcs.m_vertices[0],
+ dcs.m_vertices.size(),
+ dcs.m_elements.empty() ? NULL : &dcs.m_elements[0],
+ dcs.m_elements.size(),
+ dcs.m_calculations.empty() ? NULL : &dcs.m_calculations[0],
+ dcs.m_calculations.size(),
+ dcs.m_defaultAdjustValues.empty() ? NULL :
+ &dcs.m_defaultAdjustValues[0],
+ dcs.m_defaultAdjustValues.size(),
+ dcs.m_textRectangles.empty() ? NULL : &dcs.m_textRectangles[0],
+ dcs.m_textRectangles.size(),
+ dcs.m_coordWidth, dcs.m_coordHeight,
+ dcs.m_gluePoints.empty() ? NULL : &dcs.m_gluePoints[0],
+ dcs.m_gluePoints.size(),
+ dcs.m_adjustShiftMask
+ ));
}
}
diff --git a/src/lib/PolygonUtils.h b/src/lib/PolygonUtils.h
index 24ac3ac..ede0213 100644
--- a/src/lib/PolygonUtils.h
+++ b/src/lib/PolygonUtils.h
@@ -10,11 +10,11 @@
#ifndef __POLYGONUTILS_H__
#define __POLYGONUTILS_H__
+#include <memory>
#include <vector>
#include <librevenge/librevenge.h>
#include <boost/function.hpp>
-#include <boost/shared_ptr.hpp>
#include "ShapeType.h"
#include "VectorTransformation2D.h"
@@ -110,12 +110,12 @@ struct DynamicCustomShape
}
};
-boost::shared_ptr<const CustomShape> getFromDynamicCustomShape(const DynamicCustomShape &dcs);
+std::shared_ptr<const CustomShape> getFromDynamicCustomShape(const DynamicCustomShape &dcs);
const CustomShape *getCustomShape(ShapeType type);
bool isShapeTypeRectangle(ShapeType type);
-librevenge::RVNGPropertyList calcClipPath(const std::vector<libmspub::Vertex> &verts, double x, double y, double height, double width, VectorTransformation2D transform, boost::shared_ptr<const CustomShape> shape);
-void writeCustomShape(ShapeType shapeType, librevenge::RVNGPropertyList &graphicsProps, librevenge::RVNGDrawingInterface *painter, double x, double y, double height, double width, bool closeEverything, VectorTransformation2D transform, std::vector<Line> lines, boost::function<double(unsigned index)> calculator, const std::vector<Color> &palette, boost::shared_ptr<const CustomShape> shape);
+librevenge::RVNGPropertyList calcClipPath(const std::vector<libmspub::Vertex> &verts, double x, double y, double height, double width, VectorTransformation2D transform, std::shared_ptr<const CustomShape> shape);
+void writeCustomShape(ShapeType shapeType, librevenge::RVNGPropertyList &graphicsProps, librevenge::RVNGDrawingInterface *painter, double x, double y, double height, double width, bool closeEverything, VectorTransformation2D transform, std::vector<Line> lines, boost::function<double(unsigned index)> calculator, const std::vector<Color> &palette, std::shared_ptr<const CustomShape> shape);
} // libmspub
#endif /* __POLYGONUTILS_H__ */
diff --git a/src/lib/ShapeInfo.h b/src/lib/ShapeInfo.h
index 372191e..f175150 100644
--- a/src/lib/ShapeInfo.h
+++ b/src/lib/ShapeInfo.h
@@ -10,8 +10,8 @@
#ifndef __SHAPEINFO_H__
#define __SHAPEINFO_H__
#include <boost/optional.hpp>
-#include <boost/shared_ptr.hpp>
#include <map>
+#include <memory>
#include <vector>
#include <boost/function.hpp>
#include "ShapeType.h"
@@ -47,7 +47,7 @@ struct ShapeInfo
boost::optional<std::pair<bool, bool> > m_flips;
boost::optional<Margins> m_margins;
boost::optional<BorderPosition> m_borderPosition; // Irrelevant except for rectangular shapes
- boost::shared_ptr<const Fill> m_fill;
+ std::shared_ptr<const Fill> m_fill;
boost::optional<DynamicCustomShape> m_customShape;
bool m_stretchBorderArt;
boost::optional<ColorReference> m_lineBackColor;
@@ -75,7 +75,7 @@ struct ShapeInfo
m_verticalAlign(), m_pictureRecolor(), m_shadow(), m_innerRotation(), m_clipPath(), m_pictureBrightness(), m_pictureContrast()
{
}
- boost::shared_ptr<const CustomShape> getCustomShape() const
+ std::shared_ptr<const CustomShape> getCustomShape() const
{
if (bool(m_customShape))
{
@@ -83,11 +83,11 @@ struct ShapeInfo
}
if (bool(m_cropType))
{
- return boost::shared_ptr<const CustomShape>(
+ return std::shared_ptr<const CustomShape>(
libmspub::getCustomShape(m_cropType.get()),
boost::function<void (const CustomShape *)>(noop));
}
- return boost::shared_ptr<const CustomShape>(
+ return std::shared_ptr<const CustomShape>(
libmspub::getCustomShape(m_type.get_value_or(RECTANGLE)),
boost::function<void (const CustomShape *)>(noop));
}
commit 3761bb69fb2e316083785de5134d5a4c111796a0
Author: David Tardon <dtardon at redhat.com>
Date: Wed Apr 12 19:07:40 2017 +0200
boost::scoped_ptr -> std::unique_ptr
Change-Id: I62a7d4113c33ab909dd957fb9d8cbafdc9a5f19d
diff --git a/configure.ac b/configure.ac
index 8007987..90bc39f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,7 +100,6 @@ AC_CHECK_HEADERS(
boost/numeric/conversion/cast.hpp \
boost/optional.hpp \
boost/ptr_container/ptr_vector.hpp \
- boost/scoped_ptr.hpp \
boost/shared_ptr.hpp,
[],
[AC_MSG_ERROR(Required boost headers not found. Install boost)],
diff --git a/src/lib/MSPUBDocument.cpp b/src/lib/MSPUBDocument.cpp
index 452b6eb..c67639b 100644
--- a/src/lib/MSPUBDocument.cpp
+++ b/src/lib/MSPUBDocument.cpp
@@ -7,10 +7,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <memory>
#include <sstream>
#include <string>
#include <string.h>
-#include <boost/scoped_ptr.hpp>
+
#include <libmspub/libmspub.h>
#include "MSPUBCollector.h"
@@ -39,7 +40,7 @@ MSPUBVersion getVersion(librevenge::RVNGInputStream *input)
if (!input->isStructured())
return MSPUB_UNKNOWN_VERSION;
- boost::scoped_ptr<librevenge::RVNGInputStream> contentsStream(input->getSubStreamByName("Contents"));
+ std::unique_ptr<librevenge::RVNGInputStream> contentsStream(input->getSubStreamByName("Contents"));
if (!contentsStream)
return MSPUB_UNKNOWN_VERSION;
@@ -95,10 +96,10 @@ PUBAPI bool MSPUBDocument::isSupported(librevenge::RVNGInputStream *input)
if (version == MSPUB_2K2)
{
- boost::scoped_ptr<librevenge::RVNGInputStream> escherStream(input->getSubStreamByName("Escher/EscherStm"));
+ std::unique_ptr<librevenge::RVNGInputStream> escherStream(input->getSubStreamByName("Escher/EscherStm"));
if (!escherStream)
return false;
- boost::scoped_ptr<librevenge::RVNGInputStream> quillStream(input->getSubStreamByName("Quill/QuillSub/CONTENTS"));
+ std::unique_ptr<librevenge::RVNGInputStream> quillStream(input->getSubStreamByName("Quill/QuillSub/CONTENTS"));
if (!quillStream)
return false;
}
@@ -127,12 +128,12 @@ PUBAPI bool MSPUBDocument::parse(librevenge::RVNGInputStream *input, librevenge:
{
MSPUBCollector collector(painter);
input->seek(0, librevenge::RVNG_SEEK_SET);
- boost::scoped_ptr<MSPUBParser> parser;
+ std::unique_ptr<MSPUBParser> parser;
switch (getVersion(input))
{
case MSPUB_2K:
{
- boost::scoped_ptr<librevenge::RVNGInputStream> quillStream(input->getSubStreamByName("Quill/QuillSub/CONTENTS"));
+ std::unique_ptr<librevenge::RVNGInputStream> quillStream(input->getSubStreamByName("Quill/QuillSub/CONTENTS"));
if (!quillStream)
parser.reset(new MSPUBParser97(input, &collector));
else
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 95d3769..4712e03 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -8,6 +8,7 @@
*/
#include <cassert>
+#include <memory>
#include <set>
#include <sstream>
#include <string>
@@ -16,7 +17,6 @@
#include <string.h>
#include <boost/numeric/conversion/cast.hpp>
-#include <boost/scoped_ptr.hpp>
#include <librevenge-stream/librevenge-stream.h>
#include <zlib.h>
@@ -127,7 +127,7 @@ bool MSPUBParser::parse()
return false;
// No check: metadata are not important enough to fail if they can't be parsed
parseMetaData();
- boost::scoped_ptr<librevenge::RVNGInputStream> quill(m_input->getSubStreamByName("Quill/QuillSub/CONTENTS"));
+ std::unique_ptr<librevenge::RVNGInputStream> quill(m_input->getSubStreamByName("Quill/QuillSub/CONTENTS"));
if (!quill)
{
MSPUB_DEBUG_MSG(("Couldn't get quill stream.\n"));
@@ -138,7 +138,7 @@ bool MSPUBParser::parse()
MSPUB_DEBUG_MSG(("Couldn't parse quill stream.\n"));
return false;
}
- boost::scoped_ptr<librevenge::RVNGInputStream> contents(m_input->getSubStreamByName("Contents"));
+ std::unique_ptr<librevenge::RVNGInputStream> contents(m_input->getSubStreamByName("Contents"));
if (!contents)
{
MSPUB_DEBUG_MSG(("Couldn't get contents stream.\n"));
@@ -149,12 +149,12 @@ bool MSPUBParser::parse()
MSPUB_DEBUG_MSG(("Couldn't parse contents stream.\n"));
return false;
}
- boost::scoped_ptr<librevenge::RVNGInputStream> escherDelay(m_input->getSubStreamByName("Escher/EscherDelayStm"));
+ std::unique_ptr<librevenge::RVNGInputStream> escherDelay(m_input->getSubStreamByName("Escher/EscherDelayStm"));
if (escherDelay)
{
parseEscherDelay(escherDelay.get());
}
- boost::scoped_ptr<librevenge::RVNGInputStream> escher(m_input->getSubStreamByName("Escher/EscherStm"));
+ std::unique_ptr<librevenge::RVNGInputStream> escher(m_input->getSubStreamByName("Escher/EscherStm"));
if (!escher)
{
MSPUB_DEBUG_MSG(("Couldn't get escher stream.\n"));
@@ -2527,13 +2527,13 @@ bool MSPUBParser::parseMetaData()
m_input->seek(0, librevenge::RVNG_SEEK_SET);
MSPUBMetaData metaData;
- boost::scoped_ptr<librevenge::RVNGInputStream> sumaryInfo(m_input->getSubStreamByName("\x05SummaryInformation"));
+ std::unique_ptr<librevenge::RVNGInputStream> sumaryInfo(m_input->getSubStreamByName("\x05SummaryInformation"));
if (sumaryInfo)
{
metaData.parse(sumaryInfo.get());
}
- boost::scoped_ptr<librevenge::RVNGInputStream> docSumaryInfo(m_input->getSubStreamByName("\005DocumentSummaryInformation"));
+ std::unique_ptr<librevenge::RVNGInputStream> docSumaryInfo(m_input->getSubStreamByName("\005DocumentSummaryInformation"));
if (docSumaryInfo)
{
metaData.parse(docSumaryInfo.get());
diff --git a/src/lib/MSPUBParser97.cpp b/src/lib/MSPUBParser97.cpp
index ec99ca2..f3b29a2 100644
--- a/src/lib/MSPUBParser97.cpp
+++ b/src/lib/MSPUBParser97.cpp
@@ -9,10 +9,9 @@
#include "MSPUBParser97.h"
+#include <memory>
#include <utility>
-#include <boost/scoped_ptr.hpp>
-
#include "MSPUBCollector.h"
#include "libmspub_utils.h"
#include "MSPUBTypes.h"
@@ -38,7 +37,7 @@ unsigned MSPUBParser97::getTextIdOffset() const
bool MSPUBParser97::parse()
{
- boost::scoped_ptr<librevenge::RVNGInputStream> contents(m_input->getSubStreamByName("Contents"));
+ std::unique_ptr<librevenge::RVNGInputStream> contents(m_input->getSubStreamByName("Contents"));
if (!contents)
{
MSPUB_DEBUG_MSG(("Couldn't get contents stream.\n"));
commit ce070c6f73307b9db5b63ce791fec2f05fa87eef
Author: David Tardon <dtardon at redhat.com>
Date: Wed Apr 12 19:02:50 2017 +0200
switch to C++11
Change-Id: I049fc4bf37667192b0ae997ad150cde3632d8df3
diff --git a/configure.ac b/configure.ac
index 2915625..8007987 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,6 +33,8 @@ AC_PROG_MAKE_SET
LT_INIT([win32-dll disable-static pic-only])
AC_CANONICAL_HOST
+AX_CXX_COMPILE_STDCXX_11
+
PKG_PROG_PKG_CONFIG([0.20])
# ===============
diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4
new file mode 100644
index 0000000..5032bba
--- /dev/null
+++ b/m4/ax_cxx_compile_stdcxx.m4
@@ -0,0 +1,982 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional])
+#
+# DESCRIPTION
+#
+# Check for baseline language coverage in the compiler for the specified
+# version of the C++ standard. If necessary, add switches to CXX and
+# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard)
+# or '14' (for the C++14 standard).
+#
+# The second argument, if specified, indicates whether you insist on an
+# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
+# -std=c++11). If neither is specified, you get whatever works, with
+# preference for an extended mode.
+#
+# The third argument, if specified 'mandatory' or if left unspecified,
+# indicates that baseline support for the specified C++ standard is
+# required and that the macro should error out if no mode with that
+# support is found. If specified 'optional', then configuration proceeds
+# regardless, after defining HAVE_CXX${VERSION} if and only if a
+# supporting mode is found.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Benjamin Kosnik <bkoz at redhat.com>
+# Copyright (c) 2012 Zack Weinberg <zackw at panix.com>
+# Copyright (c) 2013 Roy Stogner <roystgnr at ices.utexas.edu>
+# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov at google.com>
+# Copyright (c) 2015 Paul Norman <penorman at mac.com>
+# Copyright (c) 2015 Moritz Klammler <moritz at klammler.eu>
+# Copyright (c) 2016 Krzesimir Nowak <qdlacz at gmail.com>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 7
+
+dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
+dnl (serial version number 13).
+
+AX_REQUIRE_DEFINED([AC_MSG_WARN])
+AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
+ m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
+ [$1], [14], [ax_cxx_compile_alternatives="14 1y"],
+ [$1], [17], [ax_cxx_compile_alternatives="17 1z"],
+ [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
+ m4_if([$2], [], [],
+ [$2], [ext], [],
+ [$2], [noext], [],
+ [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl
+ m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true],
+ [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
+ [$3], [optional], [ax_cxx_compile_cxx$1_required=false],
+ [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
+ AC_LANG_PUSH([C++])dnl
+ ac_success=no
+ AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
+ ax_cv_cxx_compile_cxx$1,
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
+ [ax_cv_cxx_compile_cxx$1=yes],
+ [ax_cv_cxx_compile_cxx$1=no])])
+ if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
+ ac_success=yes
+ fi
+
+ m4_if([$2], [noext], [], [dnl
+ if test x$ac_success = xno; then
+ for alternative in ${ax_cxx_compile_alternatives}; do
+ switch="-std=gnu++${alternative}"
+ cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
+ AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
+ $cachevar,
+ [ac_save_CXX="$CXX"
+ CXX="$CXX $switch"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
+ [eval $cachevar=yes],
+ [eval $cachevar=no])
+ CXX="$ac_save_CXX"])
+ if eval test x\$$cachevar = xyes; then
+ CXX="$CXX $switch"
+ if test -n "$CXXCPP" ; then
+ CXXCPP="$CXXCPP $switch"
+ fi
+ ac_success=yes
+ break
+ fi
+ done
+ fi])
+
+ m4_if([$2], [ext], [], [dnl
+ if test x$ac_success = xno; then
+ dnl HP's aCC needs +std=c++11 according to:
+ dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
+ dnl Cray's crayCC needs "-h std=c++11"
+ for alternative in ${ax_cxx_compile_alternatives}; do
+ for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
+ cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
+ AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
+ $cachevar,
+ [ac_save_CXX="$CXX"
+ CXX="$CXX $switch"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
+ [eval $cachevar=yes],
+ [eval $cachevar=no])
+ CXX="$ac_save_CXX"])
+ if eval test x\$$cachevar = xyes; then
+ CXX="$CXX $switch"
+ if test -n "$CXXCPP" ; then
+ CXXCPP="$CXXCPP $switch"
+ fi
+ ac_success=yes
+ break
+ fi
+ done
+ if test x$ac_success = xyes; then
+ break
+ fi
+ done
+ fi])
+ AC_LANG_POP([C++])
+ if test x$ax_cxx_compile_cxx$1_required = xtrue; then
+ if test x$ac_success = xno; then
+ AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.])
+ fi
+ fi
+ if test x$ac_success = xno; then
+ HAVE_CXX$1=0
+ AC_MSG_NOTICE([No compiler with C++$1 support was found])
+ else
+ HAVE_CXX$1=1
+ AC_DEFINE(HAVE_CXX$1,1,
+ [define if the compiler supports basic C++$1 syntax])
+ fi
+ AC_SUBST(HAVE_CXX$1)
+ m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may change in incompatible ways anytime])])
+])
+
+
+dnl Test body for checking C++11 support
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
+)
+
+
+dnl Test body for checking C++14 support
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
+)
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
+ _AX_CXX_COMPILE_STDCXX_testbody_new_in_17
+)
+
+dnl Tests for new features in C++11
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
+
+// If the compiler admits that it is not ready for C++11, why torture it?
+// Hopefully, this will speed up the test.
+
+#ifndef __cplusplus
+
+#error "This is not a C++ compiler"
+
+#elif __cplusplus < 201103L
+
+#error "This is not a C++11 compiler"
+
+#else
+
+namespace cxx11
+{
+
+ namespace test_static_assert
+ {
+
+ template <typename T>
+ struct check
+ {
+ static_assert(sizeof(int) <= sizeof(T), "not big enough");
+ };
+
+ }
+
+ namespace test_final_override
+ {
+
+ struct Base
+ {
+ virtual void f() {}
+ };
+
+ struct Derived : public Base
+ {
+ virtual void f() override {}
+ };
+
+ }
+
+ namespace test_double_right_angle_brackets
+ {
+
+ template < typename T >
+ struct check {};
+
+ typedef check<void> single_type;
+ typedef check<check<void>> double_type;
+ typedef check<check<check<void>>> triple_type;
+ typedef check<check<check<check<void>>>> quadruple_type;
+
+ }
+
+ namespace test_decltype
+ {
+
+ int
+ f()
+ {
+ int a = 1;
+ decltype(a) b = 2;
+ return a + b;
+ }
+
+ }
+
+ namespace test_type_deduction
+ {
+
+ template < typename T1, typename T2 >
+ struct is_same
+ {
+ static const bool value = false;
+ };
+
+ template < typename T >
+ struct is_same<T, T>
+ {
+ static const bool value = true;
+ };
+
+ template < typename T1, typename T2 >
+ auto
+ add(T1 a1, T2 a2) -> decltype(a1 + a2)
+ {
+ return a1 + a2;
+ }
+
+ int
+ test(const int c, volatile int v)
+ {
+ static_assert(is_same<int, decltype(0)>::value == true, "");
+ static_assert(is_same<int, decltype(c)>::value == false, "");
+ static_assert(is_same<int, decltype(v)>::value == false, "");
+ auto ac = c;
+ auto av = v;
+ auto sumi = ac + av + 'x';
+ auto sumf = ac + av + 1.0;
+ static_assert(is_same<int, decltype(ac)>::value == true, "");
+ static_assert(is_same<int, decltype(av)>::value == true, "");
+ static_assert(is_same<int, decltype(sumi)>::value == true, "");
+ static_assert(is_same<int, decltype(sumf)>::value == false, "");
+ static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
+ return (sumf > 0.0) ? sumi : add(c, v);
+ }
+
+ }
+
+ namespace test_noexcept
+ {
+
+ int f() { return 0; }
+ int g() noexcept { return 0; }
+
+ static_assert(noexcept(f()) == false, "");
+ static_assert(noexcept(g()) == true, "");
+
+ }
+
+ namespace test_constexpr
+ {
+
+ template < typename CharT >
+ unsigned long constexpr
+ strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
+ {
+ return *s ? strlen_c_r(s + 1, acc + 1) : acc;
+ }
+
+ template < typename CharT >
+ unsigned long constexpr
+ strlen_c(const CharT *const s) noexcept
+ {
+ return strlen_c_r(s, 0UL);
+ }
+
+ static_assert(strlen_c("") == 0UL, "");
+ static_assert(strlen_c("1") == 1UL, "");
+ static_assert(strlen_c("example") == 7UL, "");
+ static_assert(strlen_c("another\0example") == 7UL, "");
+
+ }
+
+ namespace test_rvalue_references
+ {
+
+ template < int N >
+ struct answer
+ {
+ static constexpr int value = N;
+ };
+
+ answer<1> f(int&) { return answer<1>(); }
+ answer<2> f(const int&) { return answer<2>(); }
+ answer<3> f(int&&) { return answer<3>(); }
+
+ void
+ test()
+ {
+ int i = 0;
+ const int c = 0;
+ static_assert(decltype(f(i))::value == 1, "");
+ static_assert(decltype(f(c))::value == 2, "");
+ static_assert(decltype(f(0))::value == 3, "");
+ }
+
+ }
+
+ namespace test_uniform_initialization
+ {
+
+ struct test
+ {
+ static const int zero {};
+ static const int one {1};
+ };
+
+ static_assert(test::zero == 0, "");
+ static_assert(test::one == 1, "");
+
+ }
+
+ namespace test_lambdas
+ {
+
+ void
+ test1()
+ {
+ auto lambda1 = [](){};
+ auto lambda2 = lambda1;
+ lambda1();
+ lambda2();
+ }
+
+ int
+ test2()
+ {
+ auto a = [](int i, int j){ return i + j; }(1, 2);
+ auto b = []() -> int { return '0'; }();
+ auto c = [=](){ return a + b; }();
+ auto d = [&](){ return c; }();
+ auto e = [a, &b](int x) mutable {
+ const auto identity = [](int y){ return y; };
+ for (auto i = 0; i < a; ++i)
+ a += b--;
+ return x + identity(a + b);
+ }(0);
+ return a + b + c + d + e;
+ }
+
+ int
+ test3()
+ {
+ const auto nullary = [](){ return 0; };
+ const auto unary = [](int x){ return x; };
+ using nullary_t = decltype(nullary);
+ using unary_t = decltype(unary);
+ const auto higher1st = [](nullary_t f){ return f(); };
+ const auto higher2nd = [unary](nullary_t f1){
+ return [unary, f1](unary_t f2){ return f2(unary(f1())); };
+ };
+ return higher1st(nullary) + higher2nd(nullary)(unary);
+ }
+
+ }
+
+ namespace test_variadic_templates
+ {
+
+ template <int...>
+ struct sum;
+
+ template <int N0, int... N1toN>
+ struct sum<N0, N1toN...>
+ {
+ static constexpr auto value = N0 + sum<N1toN...>::value;
+ };
+
+ template <>
+ struct sum<>
+ {
+ static constexpr auto value = 0;
+ };
+
+ static_assert(sum<>::value == 0, "");
+ static_assert(sum<1>::value == 1, "");
+ static_assert(sum<23>::value == 23, "");
+ static_assert(sum<1, 2>::value == 3, "");
+ static_assert(sum<5, 5, 11>::value == 21, "");
+ static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
+
+ }
+
+ // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
+ // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
+ // because of this.
+ namespace test_template_alias_sfinae
+ {
+
+ struct foo {};
+
+ template<typename T>
+ using member = typename T::member_type;
+
+ template<typename T>
+ void func(...) {}
+
+ template<typename T>
+ void func(member<T>*) {}
+
+ void test();
+
+ void test() { func<foo>(0); }
+
+ }
+
+} // namespace cxx11
+
+#endif // __cplusplus >= 201103L
+
+]])
+
+
+dnl Tests for new features in C++14
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[
+
+// If the compiler admits that it is not ready for C++14, why torture it?
+// Hopefully, this will speed up the test.
+
+#ifndef __cplusplus
+
+#error "This is not a C++ compiler"
+
+#elif __cplusplus < 201402L
+
+#error "This is not a C++14 compiler"
+
+#else
+
+namespace cxx14
+{
+
+ namespace test_polymorphic_lambdas
+ {
+
+ int
+ test()
+ {
+ const auto lambda = [](auto&&... args){
+ const auto istiny = [](auto x){
+ return (sizeof(x) == 1UL) ? 1 : 0;
+ };
+ const int aretiny[] = { istiny(args)... };
+ return aretiny[0];
+ };
+ return lambda(1, 1L, 1.0f, '1');
+ }
+
+ }
+
+ namespace test_binary_literals
+ {
+
+ constexpr auto ivii = 0b0000000000101010;
+ static_assert(ivii == 42, "wrong value");
+
+ }
+
+ namespace test_generalized_constexpr
+ {
+
+ template < typename CharT >
+ constexpr unsigned long
+ strlen_c(const CharT *const s) noexcept
+ {
+ auto length = 0UL;
+ for (auto p = s; *p; ++p)
+ ++length;
+ return length;
+ }
+
+ static_assert(strlen_c("") == 0UL, "");
+ static_assert(strlen_c("x") == 1UL, "");
+ static_assert(strlen_c("test") == 4UL, "");
+ static_assert(strlen_c("another\0test") == 7UL, "");
+
+ }
+
+ namespace test_lambda_init_capture
+ {
+
+ int
+ test()
+ {
+ auto x = 0;
+ const auto lambda1 = [a = x](int b){ return a + b; };
+ const auto lambda2 = [a = lambda1(x)](){ return a; };
+ return lambda2();
+ }
+
+ }
+
+ namespace test_digit_separators
+ {
+
+ constexpr auto ten_million = 100'000'000;
+ static_assert(ten_million == 100000000, "");
+
+ }
+
+ namespace test_return_type_deduction
+ {
+
+ auto f(int& x) { return x; }
+ decltype(auto) g(int& x) { return x; }
+
+ template < typename T1, typename T2 >
+ struct is_same
+ {
+ static constexpr auto value = false;
+ };
+
+ template < typename T >
+ struct is_same<T, T>
+ {
+ static constexpr auto value = true;
+ };
+
+ int
+ test()
+ {
+ auto x = 0;
+ static_assert(is_same<int, decltype(f(x))>::value, "");
+ static_assert(is_same<int&, decltype(g(x))>::value, "");
+ return x;
+ }
+
+ }
+
+} // namespace cxx14
+
+#endif // __cplusplus >= 201402L
+
+]])
+
+
+dnl Tests for new features in C++17
+
+m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
+
+// If the compiler admits that it is not ready for C++17, why torture it?
+// Hopefully, this will speed up the test.
+
+#ifndef __cplusplus
+
+#error "This is not a C++ compiler"
+
+#elif __cplusplus <= 201402L
+
+#error "This is not a C++17 compiler"
+
+#else
+
+#if defined(__clang__)
+ #define REALLY_CLANG
+#else
+ #if defined(__GNUC__)
+ #define REALLY_GCC
+ #endif
+#endif
+
+#include <initializer_list>
+#include <utility>
+#include <type_traits>
+
+namespace cxx17
+{
+
+#if !defined(REALLY_CLANG)
+ namespace test_constexpr_lambdas
+ {
+
+ // TODO: test it with clang++ from git
+
+ constexpr int foo = [](){return 42;}();
+
+ }
+#endif // !defined(REALLY_CLANG)
+
+ namespace test::nested_namespace::definitions
+ {
+
+ }
+
+ namespace test_fold_expression
+ {
+
+ template<typename... Args>
+ int multiply(Args... args)
+ {
+ return (args * ... * 1);
+ }
+
+ template<typename... Args>
+ bool all(Args... args)
+ {
+ return (args && ...);
+ }
+
+ }
+
+ namespace test_extended_static_assert
+ {
+
+ static_assert (true);
+
+ }
+
+ namespace test_auto_brace_init_list
+ {
+
+ auto foo = {5};
+ auto bar {5};
+
+ static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value);
+ static_assert(std::is_same<int, decltype(bar)>::value);
+ }
+
+ namespace test_typename_in_template_template_parameter
+ {
+
+ template<template<typename> typename X> struct D;
+
+ }
+
+ namespace test_fallthrough_nodiscard_maybe_unused_attributes
+ {
+
+ int f1()
+ {
+ return 42;
+ }
+
+ [[nodiscard]] int f2()
+ {
+ [[maybe_unused]] auto unused = f1();
+
+ switch (f1())
+ {
+ case 17:
+ f1();
+ [[fallthrough]];
+ case 42:
+ f1();
+ }
+ return f1();
+ }
+
+ }
+
+ namespace test_extended_aggregate_initialization
+ {
+
+ struct base1
+ {
+ int b1, b2 = 42;
+ };
+
+ struct base2
+ {
+ base2() {
+ b3 = 42;
+ }
+ int b3;
+ };
+
+ struct derived : base1, base2
+ {
+ int d;
+ };
+
+ derived d1 {{1, 2}, {}, 4}; // full initialization
+ derived d2 {{}, {}, 4}; // value-initialized bases
+
+ }
+
+ namespace test_general_range_based_for_loop
+ {
+
+ struct iter
+ {
+ int i;
+
+ int& operator* ()
+ {
+ return i;
+ }
+
+ const int& operator* () const
+ {
+ return i;
+ }
+
+ iter& operator++()
+ {
+ ++i;
+ return *this;
+ }
+ };
+
+ struct sentinel
+ {
+ int i;
+ };
+
+ bool operator== (const iter& i, const sentinel& s)
+ {
+ return i.i == s.i;
+ }
+
+ bool operator!= (const iter& i, const sentinel& s)
+ {
+ return !(i == s);
+ }
+
+ struct range
+ {
+ iter begin() const
+ {
+ return {0};
+ }
+
+ sentinel end() const
+ {
+ return {5};
+ }
+ };
+
+ void f()
+ {
+ range r {};
+
+ for (auto i : r)
+ {
+ [[maybe_unused]] auto v = i;
+ }
+ }
+
+ }
+
+ namespace test_lambda_capture_asterisk_this_by_value
+ {
+
+ struct t
+ {
+ int i;
+ int foo()
+ {
+ return [*this]()
+ {
+ return i;
+ }();
+ }
+ };
+
+ }
+
+ namespace test_enum_class_construction
+ {
+
+ enum class byte : unsigned char
+ {};
+
+ byte foo {42};
+
+ }
+
+ namespace test_constexpr_if
+ {
+
+ template <bool cond>
+ int f ()
+ {
+ if constexpr(cond)
+ {
+ return 13;
+ }
+ else
+ {
+ return 42;
+ }
+ }
+
+ }
+
+ namespace test_selection_statement_with_initializer
+ {
+
+ int f()
+ {
+ return 13;
+ }
+
+ int f2()
+ {
+ if (auto i = f(); i > 0)
+ {
+ return 3;
+ }
+
+ switch (auto i = f(); i + 4)
+ {
+ case 17:
+ return 2;
+
+ default:
+ return 1;
+ }
+ }
+
+ }
+
+#if !defined(REALLY_CLANG)
+ namespace test_template_argument_deduction_for_class_templates
+ {
+
+ // TODO: test it with clang++ from git
+
+ template <typename T1, typename T2>
+ struct pair
+ {
+ pair (T1 p1, T2 p2)
+ : m1 {p1},
+ m2 {p2}
+ {}
+
+ T1 m1;
+ T2 m2;
+ };
+
+ void f()
+ {
+ [[maybe_unused]] auto p = pair{13, 42u};
+ }
+
+ }
+#endif // !defined(REALLY_CLANG)
+
+ namespace test_non_type_auto_template_parameters
+ {
+
+ template <auto n>
+ struct B
+ {};
+
+ B<5> b1;
+ B<'a'> b2;
+
+ }
+
+#if !defined(REALLY_CLANG)
+ namespace test_structured_bindings
+ {
+
+ // TODO: test it with clang++ from git
+
+ int arr[2] = { 1, 2 };
+ std::pair<int, int> pr = { 1, 2 };
+
+ auto f1() -> int(&)[2]
+ {
+ return arr;
+ }
+
+ auto f2() -> std::pair<int, int>&
+ {
+ return pr;
+ }
+
+ struct S
+ {
+ int x1 : 2;
+ volatile double y1;
+ };
+
+ S f3()
+ {
+ return {};
+ }
+
+ auto [ x1, y1 ] = f1();
+ auto& [ xr1, yr1 ] = f1();
+ auto [ x2, y2 ] = f2();
+ auto& [ xr2, yr2 ] = f2();
+ const auto [ x3, y3 ] = f3();
+
+ }
+#endif // !defined(REALLY_CLANG)
+
+#if !defined(REALLY_CLANG)
+ namespace test_exception_spec_type_system
+ {
+
+ // TODO: test it with clang++ from git
+
+ struct Good {};
+ struct Bad {};
+
+ void g1() noexcept;
+ void g2();
+
+ template<typename T>
+ Bad
+ f(T*, T*);
+
+ template<typename T1, typename T2>
+ Good
+ f(T1*, T2*);
+
+ static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
+
+ }
+#endif // !defined(REALLY_CLANG)
+
+ namespace test_inline_variables
+ {
+
+ template<class T> void f(T)
+ {}
+
+ template<class T> inline T g(T)
+ {
+ return T{};
+ }
+
+ template<> inline void f<>(int)
+ {}
+
+ template<> int g<>(int)
+ {
+ return 5;
+ }
+
+ }
+
+} // namespace cxx17
+
+#endif // __cplusplus <= 201402L
+
+]])
diff --git a/m4/ax_cxx_compile_stdcxx_11.m4 b/m4/ax_cxx_compile_stdcxx_11.m4
new file mode 100644
index 0000000..1733fd8
--- /dev/null
+++ b/m4/ax_cxx_compile_stdcxx_11.m4
@@ -0,0 +1,39 @@
+# =============================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
+# =============================================================================
+#
+# SYNOPSIS
+#
+# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional])
+#
+# DESCRIPTION
+#
+# Check for baseline language coverage in the compiler for the C++11
+# standard; if necessary, add switches to CXX and CXXCPP to enable
+# support.
+#
+# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX
+# macro with the version set to C++11. The two optional arguments are
+# forwarded literally as the second and third argument respectively.
+# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for
+# more information. If you want to use this macro, you also need to
+# download the ax_cxx_compile_stdcxx.m4 file.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Benjamin Kosnik <bkoz at redhat.com>
+# Copyright (c) 2012 Zack Weinberg <zackw at panix.com>
+# Copyright (c) 2013 Roy Stogner <roystgnr at ices.utexas.edu>
+# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov at google.com>
+# Copyright (c) 2015 Paul Norman <penorman at mac.com>
+# Copyright (c) 2015 Moritz Klammler <moritz at klammler.eu>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 18
+
+AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX])
+AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])])
commit bc636751ef3209d4a80129ee5c2467a6646959eb
Author: David Tardon <dtardon at redhat.com>
Date: Wed Apr 12 19:03:56 2017 +0200
ignore tags files
Change-Id: I83388f464a6a935b82fa76f676d1eebddf5e590c
diff --git a/.gitignore b/.gitignore
index 95e8b18..d4e160a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@ ltmain.sh
missing
mkinstalldirs
stamp-h1
+tags
*.pc
*.rc
*~
commit 8f569932988c0ee5a163b15cb38516f87c2bfafb
Author: David Tardon <dtardon at redhat.com>
Date: Wed Apr 12 19:01:18 2017 +0200
only ignore generated files in m4
Change-Id: Ibb9e5bf67157a0a5cb3989ed4e0e36027f702fb0
diff --git a/.gitignore b/.gitignore
index 19907e3..95e8b18 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,7 +18,6 @@ libmspub.spec
libmspub-zip
libmspub-*.tar.*
ltmain.sh
-m4
missing
mkinstalldirs
stamp-h1
diff --git a/m4/.gitignore b/m4/.gitignore
new file mode 100644
index 0000000..94f2b51
--- /dev/null
+++ b/m4/.gitignore
@@ -0,0 +1,2 @@
+libtool.m4
+lt*.m4
More information about the Libreoffice-commits
mailing list