| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 virtual std::string TempFilename(const Pathname &dir, | 118 virtual std::string TempFilename(const Pathname &dir, |
| 119 const std::string &prefix) = 0; | 119 const std::string &prefix) = 0; |
| 120 | 120 |
| 121 // Determines the size of the file indicated by path. | 121 // Determines the size of the file indicated by path. |
| 122 virtual bool GetFileSize(const Pathname& path, size_t* size) = 0; | 122 virtual bool GetFileSize(const Pathname& path, size_t* size) = 0; |
| 123 | 123 |
| 124 // Determines a timestamp associated with the file indicated by path. | 124 // Determines a timestamp associated with the file indicated by path. |
| 125 virtual bool GetFileTime(const Pathname& path, FileTimeType which, | 125 virtual bool GetFileTime(const Pathname& path, FileTimeType which, |
| 126 time_t* time) = 0; | 126 time_t* time) = 0; |
| 127 | |
| 128 // Note: These might go into some shared config section later, but they're | |
| 129 // used by some methods in this interface, so we're leaving them here for now. | |
| 130 void SetOrganizationName(const std::string& organization) { | |
| 131 organization_name_ = organization; | |
| 132 } | |
| 133 void GetOrganizationName(std::string* organization) { | |
| 134 RTC_DCHECK(organization); | |
| 135 *organization = organization_name_; | |
| 136 } | |
| 137 void SetApplicationName(const std::string& application) { | |
| 138 application_name_ = application; | |
| 139 } | |
| 140 void GetApplicationName(std::string* application) { | |
| 141 RTC_DCHECK(application); | |
| 142 *application = application_name_; | |
| 143 } | |
| 144 | |
| 145 protected: | |
| 146 std::string organization_name_; | |
| 147 std::string application_name_; | |
| 148 }; | 127 }; |
| 149 | 128 |
| 150 class Filesystem { | 129 class Filesystem { |
| 151 public: | 130 public: |
| 152 static FilesystemInterface *default_filesystem() { | 131 static FilesystemInterface *default_filesystem() { |
| 153 RTC_DCHECK(default_filesystem_); | 132 RTC_DCHECK(default_filesystem_); |
| 154 return default_filesystem_; | 133 return default_filesystem_; |
| 155 } | 134 } |
| 156 | 135 |
| 157 static void set_default_filesystem(FilesystemInterface *filesystem) { | 136 static void set_default_filesystem(FilesystemInterface *filesystem) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 180 |
| 202 static bool GetFileSize(const Pathname& path, size_t* size) { | 181 static bool GetFileSize(const Pathname& path, size_t* size) { |
| 203 return EnsureDefaultFilesystem()->GetFileSize(path, size); | 182 return EnsureDefaultFilesystem()->GetFileSize(path, size); |
| 204 } | 183 } |
| 205 | 184 |
| 206 static bool GetFileTime(const Pathname& path, FileTimeType which, | 185 static bool GetFileTime(const Pathname& path, FileTimeType which, |
| 207 time_t* time) { | 186 time_t* time) { |
| 208 return EnsureDefaultFilesystem()->GetFileTime(path, which, time); | 187 return EnsureDefaultFilesystem()->GetFileTime(path, which, time); |
| 209 } | 188 } |
| 210 | 189 |
| 211 static void SetOrganizationName(const std::string& organization) { | |
| 212 EnsureDefaultFilesystem()->SetOrganizationName(organization); | |
| 213 } | |
| 214 | |
| 215 static void GetOrganizationName(std::string* organization) { | |
| 216 EnsureDefaultFilesystem()->GetOrganizationName(organization); | |
| 217 } | |
| 218 | |
| 219 static void SetApplicationName(const std::string& application) { | |
| 220 EnsureDefaultFilesystem()->SetApplicationName(application); | |
| 221 } | |
| 222 | |
| 223 static void GetApplicationName(std::string* application) { | |
| 224 EnsureDefaultFilesystem()->GetApplicationName(application); | |
| 225 } | |
| 226 | |
| 227 private: | 190 private: |
| 228 static FilesystemInterface* default_filesystem_; | 191 static FilesystemInterface* default_filesystem_; |
| 229 | 192 |
| 230 static FilesystemInterface *EnsureDefaultFilesystem(); | 193 static FilesystemInterface *EnsureDefaultFilesystem(); |
| 231 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Filesystem); | 194 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Filesystem); |
| 232 }; | 195 }; |
| 233 | 196 |
| 234 } // namespace rtc | 197 } // namespace rtc |
| 235 | 198 |
| 236 #endif // WEBRTC_BASE_FILEUTILS_H_ | 199 #endif // WEBRTC_BASE_FILEUTILS_H_ |
| OLD | NEW |