OLD | NEW |
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 OTS_NAME_H_ | 5 #ifndef OTS_NAME_H_ |
6 #define OTS_NAME_H_ | 6 #define OTS_NAME_H_ |
7 | 7 |
8 #include <new> | 8 #include <new> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "ots.h" | 13 #include "ots.h" |
14 | 14 |
15 namespace ots { | 15 namespace ots { |
16 | 16 |
17 struct NameRecord { | 17 struct NameRecord { |
18 NameRecord() { | 18 NameRecord() { |
19 } | 19 } |
20 | 20 |
21 NameRecord(uint16_t platform_id, uint16_t encoding_id, | 21 NameRecord(uint16_t platformID, uint16_t encodingID, |
22 uint16_t language_id, uint16_t name_id) | 22 uint16_t languageID, uint16_t nameID) |
23 : platform_id(platform_id), | 23 : platform_id(platformID), |
24 encoding_id(encoding_id), | 24 encoding_id(encodingID), |
25 language_id(language_id), | 25 language_id(languageID), |
26 name_id(name_id) { | 26 name_id(nameID) { |
27 } | 27 } |
28 | 28 |
29 uint16_t platform_id; | 29 uint16_t platform_id; |
30 uint16_t encoding_id; | 30 uint16_t encoding_id; |
31 uint16_t language_id; | 31 uint16_t language_id; |
32 uint16_t name_id; | 32 uint16_t name_id; |
33 std::string text; | 33 std::string text; |
34 | 34 |
35 bool operator<(const NameRecord& rhs) const { | 35 bool operator<(const NameRecord& rhs) const { |
36 if (platform_id < rhs.platform_id) return true; | 36 if (platform_id < rhs.platform_id) return true; |
37 if (platform_id > rhs.platform_id) return false; | 37 if (platform_id > rhs.platform_id) return false; |
38 if (encoding_id < rhs.encoding_id) return true; | 38 if (encoding_id < rhs.encoding_id) return true; |
39 if (encoding_id > rhs.encoding_id) return false; | 39 if (encoding_id > rhs.encoding_id) return false; |
40 if (language_id < rhs.language_id) return true; | 40 if (language_id < rhs.language_id) return true; |
41 if (language_id > rhs.language_id) return false; | 41 if (language_id > rhs.language_id) return false; |
42 return name_id < rhs.name_id; | 42 return name_id < rhs.name_id; |
43 } | 43 } |
44 }; | 44 }; |
45 | 45 |
46 struct OpenTypeNAME { | 46 struct OpenTypeNAME { |
47 std::vector<NameRecord> names; | 47 std::vector<NameRecord> names; |
48 std::vector<std::string> lang_tags; | 48 std::vector<std::string> lang_tags; |
49 }; | 49 }; |
50 | 50 |
51 } // namespace ots | 51 } // namespace ots |
52 | 52 |
53 #endif // OTS_NAME_H_ | 53 #endif // OTS_NAME_H_ |
OLD | NEW |