9
9
#ifndef _BOOST_MIME_HPP
10
10
#define _BOOST_MIME_HPP
11
11
12
+ #include < iosfwd>
12
13
#include < list>
13
14
#include < string>
14
15
#include < vector>
15
- #include < iosfwd>
16
16
17
- #include < boost/spirit/include/qi .hpp>
17
+ #include < boost/fusion/adapted/struct .hpp>
18
18
#include < boost/fusion/include/std_pair.hpp>
19
19
#include < boost/spirit/include/phoenix.hpp> // pulls in all of Phoenix
20
+ #include < boost/spirit/include/qi.hpp>
20
21
#include < boost/spirit/include/support_istream_iterator.hpp>
21
- #include < boost/fusion/adapted/struct.hpp>
22
22
23
- #include < boost/shared_ptr.hpp>
24
- #include < boost/format.hpp>
25
- #include < boost/algorithm/string/predicate.hpp>
26
23
#include < boost/algorithm/string.hpp>
24
+ #include < boost/algorithm/string/predicate.hpp>
25
+ #include < boost/format.hpp>
26
+ #include < boost/shared_ptr.hpp>
27
27
28
28
// #define DUMP_MIME_DATA 1
29
29
@@ -321,7 +321,8 @@ static void read_multipart_body(Iterator &begin, Iterator end,
321
321
" = %d %s" ) %
322
322
mp_body.body_prolog .size () % mp_body.sub_parts .size () %
323
323
mp_body.body_epilog .size () %
324
- (mp_body.prolog_is_missing ? " (missing)" : " " )) << std::endl;
324
+ (mp_body.prolog_is_missing ? " (missing)" : " " ))
325
+ << std::endl;
325
326
std::cout << std::endl << " ****** Multipart Body Prolog *******" << std::endl;
326
327
std::copy (mp_body.body_prolog .begin (), mp_body.body_prolog .end (),
327
328
std::ostream_iterator<char >(std::cout));
@@ -381,11 +382,7 @@ static boost::shared_ptr<basic_mime<traits> > parse_mime(
381
382
template <class traits = detail::default_types>
382
383
class basic_mime {
383
384
public:
384
- typedef enum {
385
- simple_part,
386
- multi_part,
387
- message_part
388
- } part_kind;
385
+ typedef enum { simple_part, multi_part, message_part } part_kind;
389
386
// Types for headers
390
387
typedef typename traits::string_type string_type;
391
388
typedef std::pair<std::string, string_type> headerEntry;
@@ -618,8 +615,7 @@ class basic_mime {
618
615
std::string boundary;
619
616
try {
620
617
boundary = detail::get_boundary (get_content_type_header ());
621
- }
622
- catch (std::runtime_error &) {
618
+ } catch (std::runtime_error &) {
623
619
// FIXME: Make boundary strings (more?) unique
624
620
boundary = str (boost::format (" ------=_NextPart-%s.%08ld" ) %
625
621
detail::k_package_name % std::clock ());
@@ -707,9 +703,8 @@ class basic_mime {
707
703
else if (get_part_kind () == multi_part) {
708
704
if (idx >= m_subparts.size ())
709
705
throw std::runtime_error (
710
- str (boost::format (
711
- " Trying to access part %d (of %d) sub-part to a "
712
- " multipart/xxx mime part" ) %
706
+ str (boost::format (" Trying to access part %d (of %d) sub-part to a "
707
+ " multipart/xxx mime part" ) %
713
708
idx % m_subparts.size ()));
714
709
} else { // message-part
715
710
if (get_part_kind () == message_part)
@@ -720,9 +715,8 @@ class basic_mime {
720
715
721
716
if (idx >= m_subparts.size ())
722
717
throw std::runtime_error (
723
- str (boost::format (
724
- " Trying to access part %d (of %d) sub-part to a "
725
- " message/xxx mime part" ) %
718
+ str (boost::format (" Trying to access part %d (of %d) sub-part to a "
719
+ " message/xxx mime part" ) %
726
720
idx % m_subparts.size ()));
727
721
}
728
722
}
@@ -764,12 +758,14 @@ static boost::shared_ptr<basic_mime<traits> > parse_mime(
764
758
#ifdef DUMP_MIME_DATA
765
759
std::cout << " Content-Type: " << content_type << std::endl;
766
760
std::cout << str (boost::format (" retVal->get_part_kind () = %d" ) %
767
- ((int )retVal->get_part_kind ())) << std::endl;
761
+ ((int )retVal->get_part_kind ()))
762
+ << std::endl;
768
763
#endif
769
764
770
765
if (retVal->get_part_kind () == mime_part::simple_part)
771
- retVal->set_body (detail::read_simplepart_body<
772
- typename mime_part::bodyContainer, Iterator>(begin, end));
766
+ retVal->set_body (
767
+ detail::read_simplepart_body<typename mime_part::bodyContainer,
768
+ Iterator>(begin, end));
773
769
else if (retVal->get_part_kind () == mime_part::message_part) {
774
770
// If we've got a message/xxxx, then there is no body, and we have
775
771
// a single
0 commit comments