Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: base/data_pack.h

Issue 193072: Move StringPiece into the base namespace. It is colliding (Closed)
Patch Set: take 2 Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « app/resource_bundle_win.cc ('k') | base/data_pack_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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 // DataPack represents a read-only view onto an on-disk file that contains 5 // DataPack represents a read-only view onto an on-disk file that contains
6 // (key, value) pairs of data. It's used to store static resources like 6 // (key, value) pairs of data. It's used to store static resources like
7 // translation strings and images. 7 // translation strings and images.
8 8
9 #ifndef BASE_DATA_PACK_H_ 9 #ifndef BASE_DATA_PACK_H_
10 #define BASE_DATA_PACK_H_ 10 #define BASE_DATA_PACK_H_
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/scoped_ptr.h" 13 #include "base/scoped_ptr.h"
14 14
15 namespace file_util { 15 namespace file_util {
16 class MemoryMappedFile; 16 class MemoryMappedFile;
17 } 17 }
18 class FilePath; 18 class FilePath;
19 class StringPiece;
20 19
21 namespace base { 20 namespace base {
22 21
22 class StringPiece;
23
23 class DataPack { 24 class DataPack {
24 public: 25 public:
25 DataPack(); 26 DataPack();
26 ~DataPack(); 27 ~DataPack();
27 28
28 // Load a pack file from |path|, returning false on error. 29 // Load a pack file from |path|, returning false on error.
29 bool Load(const FilePath& path); 30 bool Load(const FilePath& path);
30 31
31 // Get resource by id |resource_id|, filling in |data|. 32 // Get resource by id |resource_id|, filling in |data|.
32 // The data is owned by the DataPack object and should not be modified. 33 // The data is owned by the DataPack object and should not be modified.
33 // Returns false if the resource id isn't found. 34 // Returns false if the resource id isn't found.
34 bool Get(uint32_t resource_id, StringPiece* data); 35 bool Get(uint32_t resource_id, StringPiece* data);
35 36
36 private: 37 private:
37 // The memory-mapped data. 38 // The memory-mapped data.
38 scoped_ptr<file_util::MemoryMappedFile> mmap_; 39 scoped_ptr<file_util::MemoryMappedFile> mmap_;
39 40
40 // Number of resources in the data. 41 // Number of resources in the data.
41 size_t resource_count_; 42 size_t resource_count_;
42 43
43 DISALLOW_COPY_AND_ASSIGN(DataPack); 44 DISALLOW_COPY_AND_ASSIGN(DataPack);
44 }; 45 };
45 46
46 } // namespace base 47 } // namespace base
47 48
48 #endif // BASE_DATA_PACK_H_ 49 #endif // BASE_DATA_PACK_H_
OLDNEW
« no previous file with comments | « app/resource_bundle_win.cc ('k') | base/data_pack_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698