OLD | NEW |
| (Empty) |
1 // Copyright 2011 Google Inc. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 // ======================================================================== | |
15 | |
16 #include "omaha/common/ping_event.h" | |
17 #include "omaha/base/string.h" | |
18 #include "omaha/base/xml_utils.h" | |
19 #include "omaha/common/xml_const.h" | |
20 | |
21 namespace omaha { | |
22 | |
23 HRESULT PingEvent::ToXml(IXMLDOMNode* parent_node) const { | |
24 HRESULT hr = AddXMLAttributeNode(parent_node, | |
25 xml::kXmlNamespace, | |
26 xml::attribute::kEventType, | |
27 itostr(event_type_)); | |
28 if (FAILED(hr)) { | |
29 return hr; | |
30 } | |
31 | |
32 hr = AddXMLAttributeNode(parent_node, | |
33 xml::kXmlNamespace, | |
34 xml::attribute::kEventResult, | |
35 itostr(event_result_)); | |
36 if (FAILED(hr)) { | |
37 return hr; | |
38 } | |
39 | |
40 hr = AddXMLAttributeNode(parent_node, | |
41 xml::kXmlNamespace, | |
42 xml::attribute::kErrorCode, | |
43 itostr(error_code_)); | |
44 if (FAILED(hr)) { | |
45 return hr; | |
46 } | |
47 | |
48 return AddXMLAttributeNode(parent_node, | |
49 xml::kXmlNamespace, | |
50 xml::attribute::kExtraCode1, | |
51 itostr(extra_code1_)); | |
52 } | |
53 | |
54 CString PingEvent::ToString() const { | |
55 CString ping_str; | |
56 ping_str.Format(_T("%s=%s, %s=%s, %s=%s, %s=%s"), | |
57 xml::attribute::kEventType, itostr(event_type_), | |
58 xml::attribute::kEventResult, itostr(event_result_), | |
59 xml::attribute::kErrorCode, itostr(error_code_), | |
60 xml::attribute::kExtraCode1, itostr(extra_code1_)); | |
61 | |
62 return ping_str; | |
63 } | |
64 | |
65 } // namespace omaha | |
66 | |
OLD | NEW |