From 716237d6c01583812107fb74997b90d2b040aba2 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 21 Sep 2011 08:04:48 +0000 Subject: [PATCH] added Sed::stop() and Sed::isStop() --- qse/include/qse/sed/Sed.hpp | 16 +++++++++++++++- qse/lib/sed/Sed.cpp | 14 +++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/qse/include/qse/sed/Sed.hpp b/qse/include/qse/sed/Sed.hpp index 34098537..0d176cd4 100644 --- a/qse/include/qse/sed/Sed.hpp +++ b/qse/include/qse/sed/Sed.hpp @@ -1,5 +1,5 @@ /* - * $Id: Sed.hpp 558 2011-09-02 15:27:44Z hyunghwan.chung $ + * $Id: Sed.hpp 571 2011-09-20 14:04:48Z hyunghwan.chung $ * Copyright 2006-2011 Chung, Hyung-Hwan. This file is part of QSE. @@ -202,6 +202,20 @@ public: /// int execute (Stream& iostream); + + /// + /// The stop() function makes a request to break a running loop + /// inside execute(). Note that this does not affect blocking + /// operations in user-defined stream handlers. + /// + void stop (); + + /// + /// The isStop() function returns true if stop() has been called + /// since the last call to execute(), false otherwise. + /// + bool isStop () const; + /// /// The getOption() function gets the current options. /// @return 0 or current options ORed of #option_t enumerators. diff --git a/qse/lib/sed/Sed.cpp b/qse/lib/sed/Sed.cpp index d6270bef..6ce89cd6 100644 --- a/qse/lib/sed/Sed.cpp +++ b/qse/lib/sed/Sed.cpp @@ -1,5 +1,5 @@ /* - * $Id: Sed.cpp 558 2011-09-02 15:27:44Z hyunghwan.chung $ + * $Id: Sed.cpp 571 2011-09-20 14:04:48Z hyunghwan.chung $ * Copyright 2006-2011 Chung, Hyung-Hwan. This file is part of QSE. @@ -68,6 +68,18 @@ int Sed::execute (Stream& iostream) return qse_sed_exec (sed, xin, xout); } +void Sed::stop () +{ + QSE_ASSERT (sed != QSE_NULL); + return qse_sed_stop (sed); +} + +bool Sed::isStop () const +{ + QSE_ASSERT (sed != QSE_NULL); + return qse_sed_isstop (sed); +} + int Sed::getOption() const { QSE_ASSERT (sed != QSE_NULL);