Skip to content

Commit 616cf54

Browse files
authored
simplify namespace syntax (#73)
1 parent 82e785a commit 616cf54

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

docs/architecture/components/index.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ This represents the minimum required code to implement a component in ESPHome:
199199
200200
#include "esphome/core/component.h"
201201
202-
namespace esphome {
203-
namespace example_component {
202+
namespace esphome::example_component {
204203
205204
class ExampleComponent : public Component {
206205
public:
@@ -217,17 +216,15 @@ This represents the minimum required code to implement a component in ESPHome:
217216
int baz_{0};
218217
};
219218
220-
} // namespace example_component
221-
} // namespace esphome
219+
} // namespace esphome::example_component
222220
```
223221

224222
- **`example_component.cpp:`**
225223
```cpp
226224
#include "esphome/core/log.h"
227225
#include "example_component.h"
228226
229-
namespace esphome {
230-
namespace example_component {
227+
namespace esphome::example_component {
231228
232229
static const char *TAG = "example_component.component";
233230
@@ -248,8 +245,7 @@ This represents the minimum required code to implement a component in ESPHome:
248245
ESP_LOGCONFIG(TAG, " baz = %i", this->baz_);
249246
}
250247
251-
} // namespace example_component
252-
} // namespace esphome
248+
} // namespace esphome::example_component
253249
```
254250

255251
This represents the minimum required code to implement a component in ESPHome. While most of it is likely reasonably

0 commit comments

Comments
 (0)