OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 /* | |
6 * Constant values used for encoding navigation info. | |
7 * | |
8 * The generated JSON data is a list of LibraryInfo maps, defined as follows: | |
9 * | |
10 * LibraryInfo = { | |
11 * String NAME, // Library name. | |
12 * List<TypeInfo> TYPES, // Library types. | |
13 * List<MemberInfo> MEMBERS, // Library functions and variables. | |
14 * }; | |
15 * TypeInfo = { | |
16 * String NAME, // Type name. | |
17 * String ARGS, // Type variables, e.g. "<K,V>". Optional. | |
18 * String KIND, // One of CLASS, INTERFACE, or TYPEDEF. | |
19 * List<MemberInfo> MEMBERS, // Type fields and methods. | |
20 * }; | |
21 * MemberInfo = { | |
22 * String NAME, // Member name. | |
23 * String KIND, // One of FIELD, CONSTRUCTOR, METHOD, GETTER, or SETTER. | |
24 * String LINK_NAME, // Anchor name for the member if different from | |
25 * // NAME. | |
26 * }; | |
27 * | |
28 * | |
29 * TODO(johnniwinther): Shorten the string values to reduce JSON output size. | |
30 */ | |
31 | |
32 const String LIBRARY = 'library'; | |
33 const String CLASS = 'class'; | |
34 const String INTERFACE = 'interface'; | |
35 const String TYPEDEF = 'typedef'; | |
36 const String MEMBERS = 'members'; | |
37 const String TYPES = 'types'; | |
38 const String ARGS = 'args'; | |
39 const String NAME = 'name'; | |
40 const String KIND = 'kind'; | |
41 const String FIELD = 'field'; | |
42 const String CONSTRUCTOR = 'constructor'; | |
43 const String METHOD = 'method'; | |
44 const String GETTER = 'getter'; | |
45 const String SETTER = 'setter'; | |
46 const String LINK_NAME = 'link_name'; | |
47 | |
48 /** | |
49 * Translation of const values to strings. Used to facilitate shortening of | |
50 * constant value strings. | |
51 */ | |
52 String kindToString(String kind) { | |
53 if (kind == LIBRARY) { | |
54 return 'library'; | |
55 } else if (kind == CLASS) { | |
56 return 'class'; | |
57 } else if (kind == INTERFACE) { | |
58 return 'interface'; | |
59 } else if (kind == TYPEDEF) { | |
60 return 'typedef'; | |
61 } else if (kind == FIELD) { | |
62 return 'field'; | |
63 } else if (kind == CONSTRUCTOR) { | |
64 return 'constructor'; | |
65 } else if (kind == METHOD) { | |
66 return 'method'; | |
67 } else if (kind == GETTER) { | |
68 return 'getter'; | |
69 } else if (kind == SETTER) { | |
70 return 'setter'; | |
71 } | |
72 return ''; | |
73 } | |
OLD | NEW |