~vcs-imports/simias/trunk

« back to all changes in this revision

Viewing changes to simias/tools/gsoap/gsoap-linux-2.7/extras/fault.cpp

  • Committer: kalidasbala
  • Date: 2007-08-25 12:48:51 UTC
  • Revision ID: vcs-imports@canonical.com-20070825124851-vlfvzun3732ld196
Latest gsoap code update

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*      Contributed by Allan Kelly, June 17, 2002
 
2
        Provides C++ alternatives for
 
3
        soap_print_fault and soap_print_fault_location functions
 
4
*/
 
5
 
 
6
/******************************************************************************/
 
7
 
 
8
SOAP_FMAC1
 
9
void
 
10
SOAP_FMAC2
 
11
soap_print_fault(struct soap *soap, std::ostream& msg)
 
12
{ if (soap->error)
 
13
  { if (!*soap_faultcode(soap))
 
14
      soap_set_fault(soap);
 
15
    if (!*soap_faultstring(soap))
 
16
      *soap_faultstring(soap) = "";
 
17
    msg << "SOAP FAULT: "
 
18
        << *soap_faultcode(soap) << std::endl
 
19
        << "\"" << *soap_faultstring(soap) << "\"" << std::endl;
 
20
    if (*soap_faultdetail(soap))
 
21
      msg << "Detail: " << *soap_faultdetail(soap) << std::endl;
 
22
  }
 
23
}
 
24
 
 
25
/******************************************************************************/
 
26
 
 
27
SOAP_FMAC1
 
28
void
 
29
SOAP_FMAC2
 
30
soap_print_fault_location(struct soap *soap, std::ostream& msg)
 
31
{ int c;
 
32
  if (soap->error && soap->buflen > 0)
 
33
  { if (soap->bufidx == 0)
 
34
      soap->bufidx = 1;
 
35
    c = soap->buf[soap->bufidx-1];
 
36
    soap->buf[soap->bufidx-1] = '\0';
 
37
    if (soap->bufidx < soap->buflen)
 
38
      msg << soap->buf << static_cast<char> (c) << std::endl
 
39
          << "** HERE **" << std::endl << soap->buf+soap->bufidx
 
40
          << std::endl;
 
41
    else
 
42
      msg << soap->buf << static_cast<char> (c) << std::endl
 
43
          << "** HERE **" << std::endl;
 
44
  }
 
45
}
 
46
 
 
47
/******************************************************************************/