OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_UTILITY_MEDIA_GALLERIES_IAPPS_XML_UTILS_H_ | 5 #ifndef CHROME_UTILITY_MEDIA_GALLERIES_IAPPS_XML_UTILS_H_ |
6 #define CHROME_UTILITY_MEDIA_GALLERIES_IAPPS_XML_UTILS_H_ | 6 #define CHROME_UTILITY_MEDIA_GALLERIES_IAPPS_XML_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/platform_file.h" | 10 #include "base/files/file.h" |
11 | 11 |
12 class XmlReader; | 12 class XmlReader; |
13 | 13 |
14 namespace iapps { | 14 namespace iapps { |
15 | 15 |
16 // Like XmlReader::SkipToElement, but will advance to the next open tag if the | 16 // Like XmlReader::SkipToElement, but will advance to the next open tag if the |
17 // cursor is on a close tag. | 17 // cursor is on a close tag. |
18 bool SkipToNextElement(XmlReader* reader); | 18 bool SkipToNextElement(XmlReader* reader); |
19 | 19 |
20 // Traverse |reader| looking for a node named |name| at the current depth | 20 // Traverse |reader| looking for a node named |name| at the current depth |
21 // of |reader|. | 21 // of |reader|. |
22 bool SeekToNodeAtCurrentDepth(XmlReader* reader, const std::string& name); | 22 bool SeekToNodeAtCurrentDepth(XmlReader* reader, const std::string& name); |
23 | 23 |
24 // Search within a "dict" node for |key|. The cursor must be on the starting | 24 // Search within a "dict" node for |key|. The cursor must be on the starting |
25 // "dict" node when entering this function. | 25 // "dict" node when entering this function. |
26 bool SeekInDict(XmlReader* reader, const std::string& key); | 26 bool SeekInDict(XmlReader* reader, const std::string& key); |
27 | 27 |
28 // Get the value out of a string node. | 28 // Get the value out of a string node. |
29 bool ReadString(XmlReader* reader, std::string* result); | 29 bool ReadString(XmlReader* reader, std::string* result); |
30 | 30 |
31 // Get the value out of an integer node. | 31 // Get the value out of an integer node. |
32 bool ReadInteger(XmlReader* reader, uint64* result); | 32 bool ReadInteger(XmlReader* reader, uint64* result); |
33 | 33 |
34 // Read in the contents of the given library xml |file| and return as a string. | 34 // Read in the contents of the given library xml |file| and return as a string. |
35 std::string ReadPlatformFileAsString(const base::PlatformFile file); | 35 std::string ReadFileAsString(base::File file); |
36 | 36 |
37 } // namespace iapps | 37 } // namespace iapps |
38 | 38 |
39 #endif // CHROME_UTILITY_MEDIA_GALLERIES_IAPPS_XML_UTILS_H_ | 39 #endif // CHROME_UTILITY_MEDIA_GALLERIES_IAPPS_XML_UTILS_H_ |
OLD | NEW |