| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "tools/gn/item.h" | 5 #include "tools/gn/item.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "tools/gn/settings.h" | 8 #include "tools/gn/settings.h" |
| 9 | 9 |
| 10 Item::Item(const Settings* settings, const Label& label) | 10 Item::Item(const Settings* settings, const Label& label) |
| 11 : settings_(settings), label_(label), defined_from_(nullptr) { | 11 : settings_(settings), label_(label), defined_from_(nullptr) { |
| 12 } | 12 } |
| 13 | 13 |
| 14 Item::~Item() { | 14 Item::~Item() { |
| 15 } | 15 } |
| 16 | 16 |
| 17 Config* Item::AsConfig() { | 17 Config* Item::AsConfig() { |
| 18 return nullptr; | 18 return nullptr; |
| 19 } | 19 } |
| 20 const Config* Item::AsConfig() const { | 20 const Config* Item::AsConfig() const { |
| 21 return nullptr; | 21 return nullptr; |
| 22 } | 22 } |
| 23 Pool* Item::AsPool() { |
| 24 return nullptr; |
| 25 } |
| 26 const Pool* Item::AsPool() const { |
| 27 return nullptr; |
| 28 } |
| 23 Target* Item::AsTarget() { | 29 Target* Item::AsTarget() { |
| 24 return nullptr; | 30 return nullptr; |
| 25 } | 31 } |
| 26 const Target* Item::AsTarget() const { | 32 const Target* Item::AsTarget() const { |
| 27 return nullptr; | 33 return nullptr; |
| 28 } | 34 } |
| 29 Toolchain* Item::AsToolchain() { | 35 Toolchain* Item::AsToolchain() { |
| 30 return nullptr; | 36 return nullptr; |
| 31 } | 37 } |
| 32 const Toolchain* Item::AsToolchain() const { | 38 const Toolchain* Item::AsToolchain() const { |
| 33 return nullptr; | 39 return nullptr; |
| 34 } | 40 } |
| 35 | 41 |
| 36 std::string Item::GetItemTypeName() const { | 42 std::string Item::GetItemTypeName() const { |
| 37 if (AsConfig()) | 43 if (AsConfig()) |
| 38 return "config"; | 44 return "config"; |
| 39 if (AsTarget()) | 45 if (AsTarget()) |
| 40 return "target"; | 46 return "target"; |
| 41 if (AsToolchain()) | 47 if (AsToolchain()) |
| 42 return "toolchain"; | 48 return "toolchain"; |
| 49 if (AsPool()) |
| 50 return "pool"; |
| 43 NOTREACHED(); | 51 NOTREACHED(); |
| 44 return "this thing that I have no idea what it is"; | 52 return "this thing that I have no idea what it is"; |
| 45 } | 53 } |
| 46 | 54 |
| 47 bool Item::OnResolved(Err* err) { | 55 bool Item::OnResolved(Err* err) { |
| 48 return true; | 56 return true; |
| 49 } | 57 } |
| OLD | NEW |