2008-02-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Removed "using namespace std;" from all sources. Appended std:: 
prefix to c++
	standard classes.
	Included string.h where mem* function are used.
This commit is contained in:
Tatsuhiro Tsujikawa 2008-02-08 15:53:45 +00:00
parent d82e183d34
commit 1b7c198289
801 changed files with 12024 additions and 8627 deletions

View file

@ -3,39 +3,37 @@
#include <numeric>
#include <cppunit/extensions/HelperMacros.h>
using namespace std;
namespace aria2 {
class a2functionalTest:public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(a2functionalTest);
CPPUNIT_TEST(testMemFunSh);
CPPUNIT_TEST(testAdopt2nd);
CPPUNIT_TEST(testArrayLength);
CPPUNIT_TEST_SUITE_END();
public:
void testMemFunSh();
void testAdopt2nd();
void testArrayLength();
class Greeting {
public:
virtual ~Greeting() {}
virtual string sayGreeting() = 0;
virtual std::string sayGreeting() = 0;
virtual string sayGreetingConst() const = 0;
virtual std::string sayGreetingConst() const = 0;
};
typedef SharedHandle<Greeting> GreetingHandle;
class JapaneseGreeting:public Greeting
{
virtual string sayGreeting()
virtual std::string sayGreeting()
{
return "HAROO WAARUDO";
}
virtual string sayGreetingConst() const
virtual std::string sayGreetingConst() const
{
return "HAROO WAARUDO";
}
@ -51,9 +49,9 @@ void a2functionalTest::testMemFunSh()
{
GreetingHandle greeting = new JapaneseGreeting();
CPPUNIT_ASSERT_EQUAL(string("HAROO WAARUDO"), mem_fun_sh(&Greeting::sayGreeting)(greeting));
CPPUNIT_ASSERT_EQUAL(std::string("HAROO WAARUDO"), mem_fun_sh(&Greeting::sayGreeting)(greeting));
CPPUNIT_ASSERT_EQUAL(string("HAROO WAARUDO"), mem_fun_sh(&Greeting::sayGreetingConst)(greeting));
CPPUNIT_ASSERT_EQUAL(std::string("HAROO WAARUDO"), mem_fun_sh(&Greeting::sayGreetingConst)(greeting));
}
@ -61,15 +59,8 @@ void a2functionalTest::testAdopt2nd()
{
GreetingHandle greeting = new JapaneseGreeting();
CPPUNIT_ASSERT_EQUAL(string("A Japanese said:HAROO WAARUDO"),
adopt2nd(plus<string>(), mem_fun_sh(&Greeting::sayGreeting))("A Japanese said:", greeting));
CPPUNIT_ASSERT_EQUAL(std::string("A Japanese said:HAROO WAARUDO"),
adopt2nd(std::plus<std::string>(), mem_fun_sh(&Greeting::sayGreeting))("A Japanese said:", greeting));
}
void a2functionalTest::testArrayLength()
{
int64_t ia[] = { 1, 2, 3, 4, 5 };
int64_t zeroLengthArray[] = {};
CPPUNIT_ASSERT_EQUAL((size_t)5, arrayLength(ia));
CPPUNIT_ASSERT_EQUAL((size_t)0, arrayLength(zeroLengthArray));
}
} // namespace aria2