From e0d6e7fcb1d458a95876cedcbf1afcd05b795be5 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Sun, 27 Jun 2021 15:58:53 +0200 Subject: [PATCH] added to Space: Space & get_add_space(const wchar_t * field); Space & get_add_space(const std::wstring & field); --- src/space/space.cpp | 21 +++++++++++++++++++++ src/space/space.h | 3 +++ 2 files changed, 24 insertions(+) diff --git a/src/space/space.cpp b/src/space/space.cpp index 4c21f96..f50402c 100644 --- a/src/space/space.cpp +++ b/src/space/space.cpp @@ -1689,6 +1689,27 @@ Space * Space::get_space(const std::wstring & field) } +Space & Space::get_add_space(const wchar_t * field) +{ + pt::Space * space = get_space(field); + + if( !space ) + { + return add_empty_space(field); + } + + return *space; +} + + +Space & Space::get_add_space(const std::wstring & field) +{ + return get_add_space(field.c_str()); +} + + + + bool * Space::get_bool(const wchar_t * field) { Space * space = get_space(field); diff --git a/src/space/space.h b/src/space/space.h index 0561370..d5514ee 100644 --- a/src/space/space.h +++ b/src/space/space.h @@ -458,6 +458,9 @@ public: Space * get_space(const std::wstring & field); const Space * get_space(const std::wstring & field) const; + // find for such a space in an object, if not found then create one + Space & get_add_space(const wchar_t * field); + Space & get_add_space(const std::wstring & field); bool * get_bool(const wchar_t * field); long long * get_llong(const wchar_t * field);