Use std::shared_ptr - src-highlite.git - src-highlite

index : src-highlite.git
src-highlite
summary refs log tree commit diff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020年06月10日 22:35:15 -0600
committerTom Tromey <tom@tromey.com>2023年01月29日 18:23:29 -0700
commitd2bfd88a741cc7e2384c94a6d2104b3e5a458371 (patch)
tree48e1fcce1d114b47df35721fdad59f7b2549eaca
parente45099f4068ba514d1a934ccbf079c23e6ca08fb (diff)
downloadsrc-highlite-d2bfd88a741cc7e2384c94a6d2104b3e5a458371.tar.gz
Use std::shared_ptr
This removes the use of boost::shared_ptr, in favor of std::shared_ptr. This is an incremental step toward fully requiring C++11 and removing the Boost dependency.
Diffstat
-rw-r--r--ChangeLog 24
-rw-r--r--NEWS 2
-rw-r--r--configure.ac 4
-rw-r--r--doc/source-highlight-lib.texi 6
-rw-r--r--lib/examples/infoformatter.h 4
-rw-r--r--lib/examples/styleformatter.h 4
-rw-r--r--lib/srchilite/chartranslator.h 2
-rw-r--r--lib/srchilite/colormap.h 4
-rw-r--r--lib/srchilite/formatter.h 4
-rw-r--r--lib/srchilite/formatterfactory.h 4
-rw-r--r--lib/srchilite/highlightrule.h 1
-rw-r--r--lib/srchilite/highlightstate.h 6
-rw-r--r--lib/srchilite/linebuffer.h 4
-rw-r--r--lib/srchilite/parsestruct.h 4
-rw-r--r--lib/srchilite/preformatter.h 4
-rw-r--r--lib/srchilite/sourcehighlighter.h 4
-rw-r--r--lib/srchilite/textstyleformatterfactory.h 1
-rw-r--r--lib/srchilite/textstyles.h 2
-rw-r--r--src/source-highlight.cc 22
19 files changed, 64 insertions, 42 deletions
diff --git a/ChangeLog b/ChangeLog
index 03d6a5e..97fb875 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
2023年01月29日 Tom Tromey <tom@tromey.com>
+ * src/source-highlight.cc (main): Use std::shared_ptr.
+ * lib/srchilite/textstyles.h: Use std::shared_ptr.
+ * lib/srchilite/textstyleformatterfactory.h: Don't include
+ boost/shared_ptr.hpp.
+ * lib/srchilite/sourcehighlighter.h: Use std::shared_ptr.
+ * lib/srchilite/preformatter.h: Use std::shared_ptr.
+ * lib/srchilite/parsestruct.h: Use std::shared_ptr.
+ * lib/srchilite/linebuffer.h: Use std::shared_ptr.
+ * lib/srchilite/highlightstate.h: Use std::shared_ptr.
+ * lib/srchilite/highlightrule.h: Don't include
+ boost/shared_ptr.hpp.
+ * lib/srchilite/formatterfactory.h: Use std::shared_ptr.
+ * lib/srchilite/formatter.h: Use std::shared_ptr.
+ * lib/srchilite/colormap.h: Use std::shared_ptr.
+ * lib/srchilite/chartranslator.h: Use std::shared_ptr.
+ * lib/examples/styleformatter.h: Use std::shared_ptr.
+ * lib/examples/infoformatter.h: Use std::shared_ptr.
+ * doc/source-highlight-lib.texi (Main Classes): Mention
+ std::shared_ptr.
+ * configure.ac: Don't mention boost::shared_ptr.
+ (LIBRARY_VERSION): Bump.
+
+2023年01月29日 Tom Tromey <tom@tromey.com>
+
* doc/source-highlight.texi (Introduction): Don't use @inforef.
(Problems): Remove @refill.
* doc/source-highlight-lib.texi (Introduction, Installation)
diff --git a/NEWS b/NEWS
index afbe5b7..111485a 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,8 @@ Changes after 3.1.9
* Source highlight now requires C++11 to build
+ * Now uses the std::shared_ptr rather than the Boost equivalent
+
Version 3.1.9
* changed esc.style to work better with dark theme terminals
diff --git a/configure.ac b/configure.ac
index 4418578..7917a2c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,7 @@ AM_INIT_AUTOMAKE
#shared library versioning
-LIBRARY_VERSION=4:1:0
+LIBRARY_VERSION=5:1:0
# | | |
# +------+ | +---+
# | | |
@@ -88,8 +88,6 @@ AC_ARG_ENABLE( warnings, [ --enable-warnings enable compiler warnings], A
dnl check for Boost regular expression library
AX_BOOST_BASE([1.33.1])
AX_BOOST_REGEX
-dnl AC_CHECK_HEADERS([boost/shared_ptr.hpp])
-dnl it's no use searching for shared_ptr.hpp: it's already included in boost base
dnl test for ch-root feature
AC_SUBST(CHROOT_INPUT_DIR)
diff --git a/doc/source-highlight-lib.texi b/doc/source-highlight-lib.texi
index 165c2a4..cc625ef 100644
--- a/doc/source-highlight-lib.texi
+++ b/doc/source-highlight-lib.texi
@@ -261,9 +261,9 @@ classes of the libraries do not take a pointer or a reference
to a class, say @code{MyClass}, but an object of type @code{MyClassPtr};
these are
@cindex shared pointers
-@emph{shared pointers}, in particular the ones provided by the Boost
-libraries (they are typedefs using, e.g.,
-@code{boost::shared_ptr<MyClass>}). This will avoid dangerous dangling
+@emph{shared pointers}, in particular the ones provided by the C++
+standard library (they are typedefs using, e.g.,
+@code{std::shared_ptr<MyClass>}). This will avoid dangerous dangling
pointers and possible memory leaks in the library.
If on the contrary, a method or a constructor in a class of the library
diff --git a/lib/examples/infoformatter.h b/lib/examples/infoformatter.h
index cf61fe8..524fb21 100644
--- a/lib/examples/infoformatter.h
+++ b/lib/examples/infoformatter.h
@@ -9,7 +9,7 @@
#include <string>
#include <iostream>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include "srchilite/formatter.h"
#include "srchilite/formatterparams.h"
@@ -40,7 +40,7 @@ public:
};
/// shared pointer for InfoFormatter
-typedef boost::shared_ptr<InfoFormatter> InfoFormatterPtr;
+typedef std::shared_ptr<InfoFormatter> InfoFormatterPtr;
//> TEXINFO
#endif /* INFOFORMATTER_H_ */
diff --git a/lib/examples/styleformatter.h b/lib/examples/styleformatter.h
index 9522942..fc30793 100644
--- a/lib/examples/styleformatter.h
+++ b/lib/examples/styleformatter.h
@@ -9,7 +9,7 @@
#include <string>
#include <iostream>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include "srchilite/formatter.h"
#include "srchilite/formatterparams.h"
@@ -51,7 +51,7 @@ struct StyleFormatter: public srchilite::Formatter {
};
/// shared pointer for StyleFormatter
-typedef boost::shared_ptr<StyleFormatter> StyleFormatterPtr;
+typedef std::shared_ptr<StyleFormatter> StyleFormatterPtr;
//> TEXINFO
#endif /* STYLEFORMATTER_H_ */
diff --git a/lib/srchilite/chartranslator.h b/lib/srchilite/chartranslator.h
index 0d44ee7..7e8f1a8 100644
--- a/lib/srchilite/chartranslator.h
+++ b/lib/srchilite/chartranslator.h
@@ -79,7 +79,7 @@ public:
}
};
-typedef boost::shared_ptr<CharTranslator> CharTranslatorPtr;
+typedef std::shared_ptr<CharTranslator> CharTranslatorPtr;
}
diff --git a/lib/srchilite/colormap.h b/lib/srchilite/colormap.h
index d379d51..b5cb117 100644
--- a/lib/srchilite/colormap.h
+++ b/lib/srchilite/colormap.h
@@ -22,7 +22,7 @@
#include <map>
#include <string>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <sstream>
using std::map;
@@ -75,7 +75,7 @@ public:
};
/// shared pointer for ColorMap
-typedef boost::shared_ptr<ColorMap> ColorMapPtr;
+typedef std::shared_ptr<ColorMap> ColorMapPtr;
}
diff --git a/lib/srchilite/formatter.h b/lib/srchilite/formatter.h
index dc52108..bc93042 100644
--- a/lib/srchilite/formatter.h
+++ b/lib/srchilite/formatter.h
@@ -9,7 +9,7 @@
#include <string>
-#include <boost/shared_ptr.hpp>
+#include <memory>
namespace srchilite {
@@ -38,7 +38,7 @@ public:
};
/// shared pointer for Formatter
-typedef boost::shared_ptr<Formatter> FormatterPtr;
+typedef std::shared_ptr<Formatter> FormatterPtr;
}
diff --git a/lib/srchilite/formatterfactory.h b/lib/srchilite/formatterfactory.h
index e8c50eb..c2923a0 100644
--- a/lib/srchilite/formatterfactory.h
+++ b/lib/srchilite/formatterfactory.h
@@ -9,7 +9,7 @@
#include <string>
#include <list>
-#include <boost/shared_ptr.hpp>
+#include <memory>
using std::string;
@@ -29,7 +29,7 @@ enum StyleConstant {
typedef std::list<StyleConstant> StyleConstants;
/// shared pointer for StyleConstants
-typedef boost::shared_ptr<StyleConstants> StyleConstantsPtr;
+typedef std::shared_ptr<StyleConstants> StyleConstantsPtr;
/// iterator for StyleConstants
typedef StyleConstants::const_iterator StyleConstantsIterator;
diff --git a/lib/srchilite/highlightrule.h b/lib/srchilite/highlightrule.h
index a99e493..c545e56 100644
--- a/lib/srchilite/highlightrule.h
+++ b/lib/srchilite/highlightrule.h
@@ -8,7 +8,6 @@
#define HIGHLIGHTRULE_H_
#include <string>
-#include <boost/shared_ptr.hpp>
#include "highlightstate.h"
diff --git a/lib/srchilite/highlightstate.h b/lib/srchilite/highlightstate.h
index e1a3d52..0b50565 100644
--- a/lib/srchilite/highlightstate.h
+++ b/lib/srchilite/highlightstate.h
@@ -10,7 +10,7 @@
#include <deque>
#include <vector>
#include <string>
-#include <boost/shared_ptr.hpp>
+#include <memory>
namespace srchilite {
@@ -26,7 +26,7 @@ struct MatchingParameters;
* the same rules that do not need substitutions. Using shared pointers will
* automatically keep track of those that need to be removed.
*/
-typedef boost::shared_ptr<HighlightRule> HighlightRulePtr;
+typedef std::shared_ptr<HighlightRule> HighlightRulePtr;
/// List of rules.
typedef std::deque<HighlightRulePtr> RuleList;
@@ -38,7 +38,7 @@ typedef std::vector<std::string> ReplacementList;
class HighlightState;
/// the reference to an HighlightState
-typedef boost::shared_ptr<HighlightState> HighlightStatePtr;
+typedef std::shared_ptr<HighlightState> HighlightStatePtr;
/**
* Represents a state during the highlighting (e.g., comment state,
diff --git a/lib/srchilite/linebuffer.h b/lib/srchilite/linebuffer.h
index 9e6ab6d..dfbc815 100644
--- a/lib/srchilite/linebuffer.h
+++ b/lib/srchilite/linebuffer.h
@@ -9,7 +9,7 @@
#include <string>
#include <set>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <sstream>
@@ -70,7 +70,7 @@ public:
};
/// shared pointer for LineBuffer
-typedef boost::shared_ptr<LineBuffer> LineBufferPtr;
+typedef std::shared_ptr<LineBuffer> LineBufferPtr;
}
diff --git a/lib/srchilite/parsestruct.h b/lib/srchilite/parsestruct.h
index 987bf35..e5eb47b 100644
--- a/lib/srchilite/parsestruct.h
+++ b/lib/srchilite/parsestruct.h
@@ -14,7 +14,7 @@
#define PARSESTRUCT_H
#include <string>
-#include <boost/shared_ptr.hpp>
+#include <memory>
namespace srchilite {
@@ -29,7 +29,7 @@ struct ParseStruct
path(pa), file_name(name), line(1), pos(0) {}
};
-typedef boost::shared_ptr<ParseStruct> ParseStructPtr;
+typedef std::shared_ptr<ParseStruct> ParseStructPtr;
}
diff --git a/lib/srchilite/preformatter.h b/lib/srchilite/preformatter.h
index 89cff07..b21fc35 100644
--- a/lib/srchilite/preformatter.h
+++ b/lib/srchilite/preformatter.h
@@ -13,14 +13,14 @@
#define PREFORMATTER_H
#include <string>
-#include <boost/shared_ptr.hpp>
+#include <memory>
namespace srchilite {
class PreFormatter;
/// shared pointer for PreFormatter
-typedef boost::shared_ptr<PreFormatter> PreFormatterPtr;
+typedef std::shared_ptr<PreFormatter> PreFormatterPtr;
/**
Preformats text to be generated. This implements the
diff --git a/lib/srchilite/sourcehighlighter.h b/lib/srchilite/sourcehighlighter.h
index 2a9d567..c186093 100644
--- a/lib/srchilite/sourcehighlighter.h
+++ b/lib/srchilite/sourcehighlighter.h
@@ -10,7 +10,7 @@
#include <string>
#include <stack>
#include <sstream>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include "highlightstate.h"
#include "eventgenerator.h"
@@ -24,7 +24,7 @@ class HighlightEventListener;
struct HighlightEvent;
typedef std::stack<HighlightStatePtr> HighlightStateStack;
-typedef boost::shared_ptr<HighlightStateStack> HighlightStateStackPtr;
+typedef std::shared_ptr<HighlightStateStack> HighlightStateStackPtr;
/**
* The main class performing the highlighting of a single line. It relies on a HighlightState
diff --git a/lib/srchilite/textstyleformatterfactory.h b/lib/srchilite/textstyleformatterfactory.h
index f109ac2..61fef67 100644
--- a/lib/srchilite/textstyleformatterfactory.h
+++ b/lib/srchilite/textstyleformatterfactory.h
@@ -9,7 +9,6 @@
#include <string>
#include <list>
-#include <boost/shared_ptr.hpp>
#include "formatterfactory.h"
#include "textstyles.h"
diff --git a/lib/srchilite/textstyles.h b/lib/srchilite/textstyles.h
index f907b49..2a54679 100644
--- a/lib/srchilite/textstyles.h
+++ b/lib/srchilite/textstyles.h
@@ -74,7 +74,7 @@ struct TextStyles {
};
/// shared pointer
-typedef boost::shared_ptr<TextStyles> TextStylesPtr;
+typedef std::shared_ptr<TextStyles> TextStylesPtr;
}
diff --git a/src/source-highlight.cc b/src/source-highlight.cc
index a30f7e9..6f883e4 100644
--- a/src/source-highlight.cc
+++ b/src/source-highlight.cc
@@ -32,7 +32,7 @@
#include <cstdlib>
#include <iostream>
#include <exception>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include "srchilite/sourcehighlight.h"
@@ -129,9 +129,9 @@ int main(int argc, char * argv[]) {
}
// set possible line ranges
- boost::shared_ptr<LineRanges> lineRanges;
+ std::shared_ptr<LineRanges> lineRanges;
if (args_info.line_range_given) {
- lineRanges = boost::shared_ptr<LineRanges>(new LineRanges);
+ lineRanges = std::shared_ptr<LineRanges>(new LineRanges);
for (unsigned int i = 0; i < args_info.line_range_given; ++i) {
if (lineRanges->addRange(args_info.line_range_arg[i]) != NO_ERROR) {
string invalid_range = args_info.line_range_arg[i];
@@ -142,9 +142,9 @@ int main(int argc, char * argv[]) {
}
// set possible regex ranges
- boost::shared_ptr<RegexRanges> regexRanges;
+ std::shared_ptr<RegexRanges> regexRanges;
if (args_info.regex_range_given) {
- regexRanges = boost::shared_ptr<RegexRanges>(new RegexRanges);
+ regexRanges = std::shared_ptr<RegexRanges>(new RegexRanges);
for (unsigned int i = 0; i < args_info.regex_range_given; ++i) {
if (!regexRanges->addRegexRange(args_info.regex_range_arg[i])) {
string invalid_range = args_info.regex_range_arg[i];
@@ -161,9 +161,9 @@ int main(int argc, char * argv[]) {
// if a stopwatch is created, when it is deleted (automatically
// since we're using a shared pointer, it will print the
// elapsed seconds.
- boost::shared_ptr<StopWatch> stopwatch;
+ std::shared_ptr<StopWatch> stopwatch;
if (args_info.statistics_given) {
- stopwatch = boost::shared_ptr<StopWatch>(new StopWatch);
+ stopwatch = std::shared_ptr<StopWatch>(new StopWatch);
}
verbose = args_info.verbose_given;
@@ -276,7 +276,7 @@ int main(int argc, char * argv[]) {
// and sets all its properties according to the command line args
sourcehighlight.setDataDir(dataDir);
- boost::shared_ptr<DebugListener> debugListener;
+ std::shared_ptr<DebugListener> debugListener;
// if a simple check is required...
if (args_info.check_lang_given) {
@@ -325,7 +325,7 @@ int main(int argc, char * argv[]) {
sourcehighlight.setBinaryOutput(args_info.binary_output_given);
if (args_info.debug_langdef_given) {
- debugListener = boost::shared_ptr<DebugListener>(new DebugListener);
+ debugListener = std::shared_ptr<DebugListener>(new DebugListener);
const string debugType = args_info.debug_langdef_arg;
if (debugType == "interactive")
debugListener->setInteractive(true);
@@ -384,7 +384,7 @@ int main(int argc, char * argv[]) {
else if (gen_references_arg == "postdoc")
refposition = POSTDOC;
- boost::shared_ptr<CTagsManager> ctagsManager;
+ std::shared_ptr<CTagsManager> ctagsManager;
if (args_info.gen_references_given) {
string ctags = args_info.ctags_arg;
string ctags_file = args_info.ctags_file_arg;
@@ -403,7 +403,7 @@ int main(int argc, char * argv[]) {
}
// the ctags command must be executed if --ctags is specified with an empty string
- ctagsManager = boost::shared_ptr<CTagsManager>(new CTagsManager(
+ ctagsManager = std::shared_ptr<CTagsManager>(new CTagsManager(
ctags_file, ctags, ctags != "", refposition));
sourcehighlight.setCTagsManager(ctagsManager.get());
}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月04日 14:56:00 +0000

AltStyle によって変換されたページ (->オリジナル) /