From f9ae360def0e2484d3784a27e27bb620876caa90 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Sat, 6 Nov 2004 17:48:56 +0000 Subject: Removed "old-style" tests for encoder and mailbox. Added new test for encoder. --- tests/mailbox/main.cpp | 119 ------------------------------------------------- 1 file changed, 119 deletions(-) delete mode 100644 tests/mailbox/main.cpp (limited to 'tests/mailbox/main.cpp') diff --git a/tests/mailbox/main.cpp b/tests/mailbox/main.cpp deleted file mode 100644 index cd59d900..00000000 --- a/tests/mailbox/main.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// -// VMime library (http://vmime.sourceforge.net) -// Copyright (C) 2002-2004 Vincent Richard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// - -#include -#include -#include -#include -#include - -#include "../../src/vmime" -#include "../../examples/common.inc" - - - -std::ostream& operator<<(std::ostream& os, const vmime::text& txt) -{ - os << "["; - - for (int i = 0 ; i < txt.getWordCount() ; ++i) - { - const vmime::word& w = *txt.getWordAt(i); - - if (i != 0) - os << ","; - - os << "[" << w.getCharset().getName() << "," << w.getBuffer() << "]"; - } - - os << "]"; - - return (os); -} - - -std::ostream& operator<<(std::ostream& os, const vmime::mailbox& mbox) -{ - std::cout << "MAILBOX[name=" << mbox.getName() << ",email=" << mbox.getEmail() << "]" << std::endl; - - return (os); -} - - -std::ostream& operator<<(std::ostream& os, const vmime::mailboxGroup& group) -{ - std::cout << "GROUP[name=" << group.getName() << "]" << std::endl; - - for (int i = 0 ; i < group.getMailboxCount() ; ++i) - { - std::cout << "* " << *group.getMailboxAt(i); - } - - return (os); -} - - -int main(int argc, char* argv[]) -{ - // VMime initialization - vmime::platformDependant::setHandler(); - - - // Read data from standard input - std::ostringstream data; - std::istream* input = &std::cin; - std::ifstream file; - - if (argc >= 2) - { - file.open(argv[1], std::ios::in | std::ios::binary); - input = &file; - } - - while (!input->eof()) - { - char buffer[4096]; - input->read(buffer, sizeof(buffer)); - data.write(buffer, input->gcount()); - } - - // Parse address list and output results - vmime::addressList list; - list.parse(data.str()); - - for (int i = 0 ; i < list.getAddressCount() ; ++i) - { - const vmime::address& addr = *list.getAddressAt(i); - - if (addr.isGroup()) - { - const vmime::mailboxGroup& group = - dynamic_cast (addr); - - std::cout << group; - } - else - { - const vmime::mailbox& mbox = - dynamic_cast (addr); - - std::cout << mbox; - } - } -} -- cgit v1.2.3