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

Side by Side Diff: ui/base/text/bytes_formatting.h

Issue 7569005: Rename UI_API to UI_EXPORT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/resource/resource_bundle.h ('k') | ui/base/text/text_elider.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 UI_BASE_TEXT_BYTES_FORMATTING_H_ 5 #ifndef UI_BASE_TEXT_BYTES_FORMATTING_H_
6 #define UI_BASE_TEXT_BYTES_FORMATTING_H_ 6 #define UI_BASE_TEXT_BYTES_FORMATTING_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
11 #include "ui/ui_api.h" 11 #include "ui/base/ui_export.h"
12 12
13 namespace ui { 13 namespace ui {
14 14
15 // Simple API ------------------------------------------------------------------ 15 // Simple API ------------------------------------------------------------------
16 16
17 // Simple call to return a byte quantity as a string in human-readable format. 17 // Simple call to return a byte quantity as a string in human-readable format.
18 // Ex: FormatBytes(512) => "512 B" 18 // Ex: FormatBytes(512) => "512 B"
19 // Ex: FormatBytes(101479) => "99.1 kB" 19 // Ex: FormatBytes(101479) => "99.1 kB"
20 UI_API string16 FormatBytes(int64 bytes); 20 UI_EXPORT string16 FormatBytes(int64 bytes);
21 21
22 // Simple call to return a speed as a string in human-readable format. 22 // Simple call to return a speed as a string in human-readable format.
23 // Ex: FormatSpeed(512) => "512 B/s" 23 // Ex: FormatSpeed(512) => "512 B/s"
24 // Ex: FormatSpeed(101479) => "99.1 kB/s" 24 // Ex: FormatSpeed(101479) => "99.1 kB/s"
25 UI_API string16 FormatSpeed(int64 bytes); 25 UI_EXPORT string16 FormatSpeed(int64 bytes);
26 26
27 // Less-Simple API ------------------------------------------------------------- 27 // Less-Simple API -------------------------------------------------------------
28 28
29 enum DataUnits { 29 enum DataUnits {
30 DATA_UNITS_BYTE = 0, 30 DATA_UNITS_BYTE = 0,
31 DATA_UNITS_KIBIBYTE, 31 DATA_UNITS_KIBIBYTE,
32 DATA_UNITS_MEBIBYTE, 32 DATA_UNITS_MEBIBYTE,
33 DATA_UNITS_GIBIBYTE, 33 DATA_UNITS_GIBIBYTE,
34 DATA_UNITS_TEBIBYTE, 34 DATA_UNITS_TEBIBYTE,
35 DATA_UNITS_PEBIBYTE 35 DATA_UNITS_PEBIBYTE
36 }; 36 };
37 37
38 // Return the unit type that is appropriate for displaying the amount of bytes 38 // Return the unit type that is appropriate for displaying the amount of bytes
39 // passed in. Most of the time, an explicit call to this isn't necessary; just 39 // passed in. Most of the time, an explicit call to this isn't necessary; just
40 // use FormatBytes()/FormatSpeed() above. 40 // use FormatBytes()/FormatSpeed() above.
41 UI_API DataUnits GetByteDisplayUnits(int64 bytes); 41 UI_EXPORT DataUnits GetByteDisplayUnits(int64 bytes);
42 42
43 // Return a byte quantity as a string in human-readable format with an optional 43 // Return a byte quantity as a string in human-readable format with an optional
44 // unit suffix. Specify in the |units| argument the units to be used. 44 // unit suffix. Specify in the |units| argument the units to be used.
45 // Ex: FormatBytes(512, DATA_UNITS_KIBIBYTE, true) => "0.5 kB" 45 // Ex: FormatBytes(512, DATA_UNITS_KIBIBYTE, true) => "0.5 kB"
46 // Ex: FormatBytes(10*1024, DATA_UNITS_MEBIBYTE, false) => "0.1" 46 // Ex: FormatBytes(10*1024, DATA_UNITS_MEBIBYTE, false) => "0.1"
47 UI_API string16 FormatBytesWithUnits(int64 bytes, DataUnits units, 47 UI_EXPORT string16 FormatBytesWithUnits(int64 bytes, DataUnits units,
48 bool show_units); 48 bool show_units);
49 49
50 // As above, but with "/s" units for speed values. 50 // As above, but with "/s" units for speed values.
51 // Ex: FormatSpeed(512, DATA_UNITS_KIBIBYTE, true) => "0.5 kB/s" 51 // Ex: FormatSpeed(512, DATA_UNITS_KIBIBYTE, true) => "0.5 kB/s"
52 // Ex: FormatSpeed(10*1024, DATA_UNITS_MEBIBYTE, false) => "0.1" 52 // Ex: FormatSpeed(10*1024, DATA_UNITS_MEBIBYTE, false) => "0.1"
53 string16 FormatSpeedWithUnits(int64 bytes, DataUnits units, bool show_units); 53 string16 FormatSpeedWithUnits(int64 bytes, DataUnits units, bool show_units);
54 54
55 } // namespace ui 55 } // namespace ui
56 56
57 #endif // UI_BASE_TEXT_BYTES_FORMATTING_H_ 57 #endif // UI_BASE_TEXT_BYTES_FORMATTING_H_
OLDNEW
« no previous file with comments | « ui/base/resource/resource_bundle.h ('k') | ui/base/text/text_elider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698