Home | History | Annotate | Download | only in media_galleries
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_UTILITY_MEDIA_GALLERIES_IAPPS_XML_UTILS_H_
      6 #define CHROME_UTILITY_MEDIA_GALLERIES_IAPPS_XML_UTILS_H_
      7 
      8 #include <string>
      9 
     10 #include "base/files/file.h"
     11 
     12 class XmlReader;
     13 
     14 namespace iapps {
     15 
     16 // Like XmlReader::SkipToElement, but will advance to the next open tag if the
     17 // cursor is on a close tag.
     18 bool SkipToNextElement(XmlReader* reader);
     19 
     20 // Traverse |reader| looking for a node named |name| at the current depth
     21 // of |reader|.
     22 bool SeekToNodeAtCurrentDepth(XmlReader* reader, const std::string& name);
     23 
     24 // Search within a "dict" node for |key|. The cursor must be on the starting
     25 // "dict" node when entering this function.
     26 bool SeekInDict(XmlReader* reader, const std::string& key);
     27 
     28 // Get the value out of a string node.
     29 bool ReadString(XmlReader* reader, std::string* result);
     30 
     31 // Get the value out of an integer node.
     32 bool ReadInteger(XmlReader* reader, uint64* result);
     33 
     34 // Read in the contents of the given library xml |file| and return as a string.
     35 std::string ReadFileAsString(base::File file);
     36 
     37 }  // namespace iapps
     38 
     39 #endif  // CHROME_UTILITY_MEDIA_GALLERIES_IAPPS_XML_UTILS_H_
     40