mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	[api] Use C++17 nested namespace syntax (#9856)
This commit is contained in:
		| @@ -2045,8 +2045,7 @@ def main() -> None: | ||||
|  | ||||
| #include "proto.h" | ||||
|  | ||||
| namespace esphome { | ||||
| namespace api { | ||||
| namespace esphome::api { | ||||
|  | ||||
| """ | ||||
|  | ||||
| @@ -2057,8 +2056,7 @@ namespace api { | ||||
|     #include "esphome/core/helpers.h" | ||||
|     #include <cstring> | ||||
|  | ||||
| namespace esphome { | ||||
| namespace api { | ||||
| namespace esphome::api { | ||||
|  | ||||
| """ | ||||
|  | ||||
| @@ -2072,8 +2070,7 @@ namespace api { | ||||
|  | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|  | ||||
| namespace esphome { | ||||
| namespace api { | ||||
| namespace esphome::api { | ||||
|  | ||||
| // Helper function to append a quoted string, handling empty StringRef | ||||
| static inline void append_quoted_string(std::string &out, const StringRef &ref) { | ||||
| @@ -2265,19 +2262,16 @@ static void dump_field(std::string &out, const char *field_name, T value, int in | ||||
|  | ||||
|     content += """\ | ||||
|  | ||||
| }  // namespace api | ||||
| }  // namespace esphome | ||||
| }  // namespace esphome::api | ||||
| """ | ||||
|     cpp += """\ | ||||
|  | ||||
| }  // namespace api | ||||
| }  // namespace esphome | ||||
| }  // namespace esphome::api | ||||
| """ | ||||
|  | ||||
|     dump_cpp += """\ | ||||
|  | ||||
| }  // namespace api | ||||
| }  // namespace esphome | ||||
| }  // namespace esphome::api | ||||
|  | ||||
| #endif  // HAS_PROTO_MESSAGE_DUMP | ||||
| """ | ||||
| @@ -2299,8 +2293,7 @@ static void dump_field(std::string &out, const char *field_name, T value, int in | ||||
|  | ||||
| #include "api_pb2.h" | ||||
|  | ||||
| namespace esphome { | ||||
| namespace api { | ||||
| namespace esphome::api { | ||||
|  | ||||
| """ | ||||
|  | ||||
| @@ -2309,8 +2302,7 @@ namespace api { | ||||
| #include "api_pb2_service.h" | ||||
| #include "esphome/core/log.h" | ||||
|  | ||||
| namespace esphome { | ||||
| namespace api { | ||||
| namespace esphome::api { | ||||
|  | ||||
| static const char *const TAG = "api.service"; | ||||
|  | ||||
| @@ -2451,13 +2443,11 @@ static const char *const TAG = "api.service"; | ||||
|  | ||||
|     hpp += """\ | ||||
|  | ||||
| }  // namespace api | ||||
| }  // namespace esphome | ||||
| }  // namespace esphome::api | ||||
| """ | ||||
|     cpp += """\ | ||||
|  | ||||
| }  // namespace api | ||||
| }  // namespace esphome | ||||
| }  // namespace esphome::api | ||||
| """ | ||||
|  | ||||
|     with open(root / "api_pb2_service.h", "w", encoding="utf-8") as f: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user