2010-01-17 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Rewritten toTagString
	* src/NameMatchOptionHandler.cc
	* test/OptionHandlerTest.cc
pull/1/head
Tatsuhiro Tsujikawa 2010-01-17 13:58:42 +00:00
parent 2d74b16583
commit b5ee1b5071
3 changed files with 9 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2010-01-17 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten toTagString
* src/NameMatchOptionHandler.cc
* test/OptionHandlerTest.cc
2010-01-17 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> 2010-01-17 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added dir and files key to the response struct of aria2.tellStatus Added dir and files key to the response struct of aria2.tellStatus

View File

@ -46,6 +46,7 @@
#include "A2STR.h" #include "A2STR.h"
#include "util.h" #include "util.h"
#include "OptionHandlerException.h" #include "OptionHandlerException.h"
#include "a2functional.h"
#define NO_DESCRIPTION A2STR::NIL #define NO_DESCRIPTION A2STR::NIL
#define NO_DEFAULT_VALUE A2STR::NIL #define NO_DEFAULT_VALUE A2STR::NIL
@ -115,10 +116,7 @@ public:
virtual std::string toTagString() const virtual std::string toTagString() const
{ {
std::stringstream s; return strjoin(_tags.begin(), _tags.end(), ", ");
std::copy(_tags.begin(), _tags.end(),
std::ostream_iterator<std::string>(s, ","));
return util::trim(s.str(), ", ");
} }
virtual const std::string& getName() const virtual const std::string& getName() const

View File

@ -233,7 +233,7 @@ void OptionHandlerTest::testDefaultOptionHandler()
handler.addTag("apple"); handler.addTag("apple");
CPPUNIT_ASSERT_EQUAL(std::string("apple"), handler.toTagString()); CPPUNIT_ASSERT_EQUAL(std::string("apple"), handler.toTagString());
handler.addTag("orange"); handler.addTag("orange");
CPPUNIT_ASSERT_EQUAL(std::string("apple,orange"), handler.toTagString()); CPPUNIT_ASSERT_EQUAL(std::string("apple, orange"), handler.toTagString());
CPPUNIT_ASSERT(handler.hasTag("apple")); CPPUNIT_ASSERT(handler.hasTag("apple"));
CPPUNIT_ASSERT(handler.hasTag("orange")); CPPUNIT_ASSERT(handler.hasTag("orange"));
CPPUNIT_ASSERT(!handler.hasTag("pineapple")); CPPUNIT_ASSERT(!handler.hasTag("pineapple"));