Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / protocols / ace / INet / FTP_Response.inl
blob64115cefdb5d7131acfcd2fb9da6693c9708dd93
1 // -*- C++ -*-
2 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
4 namespace ACE
6   namespace FTP
7   {
9     ACE_INLINE
10     void Response::reset ()
11       {
12         this->status_ = NORESPONSE;
13         this->response_.size (0);
14       }
16     ACE_INLINE
17     void Response::status(int status)
18       {
19         this->status_ = status;
20       }
22     ACE_INLINE
23     int Response::status() const
24       {
25         return this->status_;
26       }
28     ACE_INLINE
29     Response& Response::operator ()(int status)
30       {
31         this->reset ();
32         this->status (status);
33         return *this;
34       }
36     ACE_INLINE
37     const ACE_Array<ACE_CString>& Response::response () const
38       {
39         return this->response_;
40       }
42     ACE_INLINE
43     Response& Response::operator <<(const ACE_CString& line)
44       {
45         ACE_Array<ACE_CString>::size_type n =
46             this->response_.size ();
47         this->response_.size (n+1);
48         this->response_[n] = line;
49         return *this;
50       }
52     ACE_INLINE
53     Response::StatusType Response::status_type (int status)
54       {
55         if (status == NORESPONSE)
56           return NORESPONSE;
57         int st = status / 100;
58         if (st >= PRELIM_OK && st <= PERMANENT_FAIL)
59           return static_cast<StatusType> (st);
60         else
61           return NOSTATE;
62       }
64     ACE_INLINE
65     Response::StatusType Response::status_type () const
66       {
67         return status_type (this->status_);
68       }
70     ACE_INLINE
71     Response::StatusSubtype Response::status_sub_type () const
72       {
73         StatusType st = this->status_type ();
74         if (st != NOSTATE && st != NORESPONSE)
75           {
76             int sst = (this->status_ - (st * 100)) / 10;
77             if (sst >= SYNTAX && sst <= FILESYSTEM)
78               return static_cast<StatusSubtype> (sst);
79           }
80         return NOSUBTYPE;
81       }
83     ACE_INLINE
84     bool Response::is_preliminary_ok () const
85       {
86         return this->status_type () == PRELIM_OK;
87       }
89     ACE_INLINE
90     bool Response::is_completed_ok () const
91       {
92         return this->status_type () == COMPLETED_OK;
93       }
95     ACE_INLINE
96     bool Response::is_intermediate_ok () const
97       {
98         return this->status_type () == INTERMEDIATE_OK;
99       }
101     ACE_INLINE
102     bool Response::is_transient_fail () const
103       {
104         return this->status_type () == TRANSIENT_FAIL;
105       }
107     ACE_INLINE
108     bool Response::is_permanent_fail () const
109       {
110         return this->status_type () == PERMANENT_FAIL;
111       }
113     ACE_INLINE
114     int Response::read_line (std::istream& is, std::ostream& os)
115       {
116         int ch;
117         for (ch = is.get ();
118              ch != eof_ && ch != '\r' && ch != '\n';
119              ch = is.get ())
120           {
121             os.put (ch);
122           }
123         return ch;
124       }
126   }
129 ACE_END_VERSIONED_NAMESPACE_DECL