Skip to content

Commit

Permalink
Revert "Revert "Remove optional typedef (#1440)" (#1464)" (#1466)
Browse files Browse the repository at this point in the history
This reverts commit 9f7784a.

Signed-off-by: Daniel Kamkha <[email protected]>

Signed-off-by: Daniel Kamkha <[email protected]>
  • Loading branch information
DanielKamkha authored Sep 1, 2022
1 parent 3328aa6 commit 11a2271
Show file tree
Hide file tree
Showing 219 changed files with 2,195 additions and 2,255 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Gluecodium project Release Notes

## Unreleased
### Breaking changes:
* The `gluecodium::optional` type alias to `std::optional` was removed from C++ generated code.

## 13.4.0
Release date: 2022-08-29
### Features:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
#include "unit/test/Foo.h"

namespace unit::test {
std::shared_ptr<Foo>
Foo::make_foo(const ::custom::common::optional< double >& parameter)
::custom::common::Return< std::shared_ptr<Foo>, std::error_code >
Foo::make_foo(const std::optional< double >& parameter)
{
return nullptr;
return {std::shared_ptr<Foo>{}};
}
} // namespace unit::test
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@

#include "unit/test/Foo.h"

#include "unit/test/Bar.h"
#include <optional>

namespace unit::test {
std::shared_ptr<Foo>
Foo::make_foo(const ::gluecodium::optional< double >& parameter)
::gluecodium::Return< std::shared_ptr<Foo>, std::error_code >
Foo::make_foo(const ::std::optional< double >& parameter)
{
return nullptr;
return {std::shared_ptr<Foo>{}};
}
} // namespace unit::test
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@
package unit.test

class Foo {
constructor make_foo(parameter: Double?)
constructor make_foo(parameter: Double?) throws Buz
}

enum Bar { ONE, TWO }

exception Buz(Bar)
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

namespace custom::common::unit::test {
std::shared_ptr<Foo>
Foo::make_foo(const ::gluecodium::optional< double >& parameter)
Foo::make_foo(const ::std::optional< double >& parameter)
{
return nullptr;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

namespace unit::test {
std::shared_ptr<Foo>
Foo::make_foo(const ::gluecodium::optional< double >& parameter)
Foo::make_foo(const ::std::optional< double >& parameter)
{
return nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion functional-tests/functional/input/src/cpp/Blobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ BlobNulls::get_breaking_null() {
return {};
}

lorem_ipsum::test::optional<std::shared_ptr<std::vector<uint8_t>>>
std::optional<std::shared_ptr<std::vector<uint8_t>>>
BlobNulls::get_valid_null() {
return {};
}
Expand Down
8 changes: 4 additions & 4 deletions functional-tests/functional/input/src/cpp/Dates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Dates::increase_date( const system_clock::time_point& input )
return input + hours(24) + hours(1) + minutes(1) + seconds(1);
}

lorem_ipsum::test::optional< system_clock::time_point >
Dates::increase_date_maybe( const lorem_ipsum::test::optional< system_clock::time_point >& input )
std::optional< system_clock::time_point >
Dates::increase_date_maybe( const std::optional< system_clock::time_point >& input )
{
return input ? *input + hours(24) + hours(1) + minutes(1) + seconds(1) : input;
}
Expand Down Expand Up @@ -69,8 +69,8 @@ DatesSteady::increase_date(const steady_clock::time_point& input) {
return input + hours(24) + hours(1) + minutes(1) + seconds(1);
}

lorem_ipsum::test::optional<steady_clock::time_point>
DatesSteady::increase_date_maybe(const lorem_ipsum::test::optional<steady_clock::time_point>& input) {
std::optional<steady_clock::time_point>
DatesSteady::increase_date_maybe(const std::optional<steady_clock::time_point>& input) {
return input ? *input + hours(24) + hours(1) + minutes(1) + seconds(1) : input;
}

Expand Down
8 changes: 4 additions & 4 deletions functional-tests/functional/input/src/cpp/Durations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ DurationSeconds::increase_duration(const seconds input) {
return input + seconds(1);
}

lorem_ipsum::test::optional<seconds>
DurationSeconds::increase_duration_maybe(const lorem_ipsum::test::optional<seconds>& input) {
std::optional<seconds>
DurationSeconds::increase_duration_maybe(const std::optional<seconds>& input) {
return input ? *input + seconds(1) : input;
}

Expand All @@ -47,8 +47,8 @@ DurationMilliseconds::increase_duration(const milliseconds input) {
return input + seconds(1);
}

lorem_ipsum::test::optional<milliseconds>
DurationMilliseconds::increase_duration_maybe(const lorem_ipsum::test::optional<milliseconds>& input) {
std::optional<milliseconds>
DurationMilliseconds::increase_duration_maybe(const std::optional<milliseconds>& input) {
return input ? *input + seconds(1) : input;
}

Expand Down
16 changes: 8 additions & 8 deletions functional-tests/functional/input/src/cpp/Lambdas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,18 @@ Lambdas::concatenate_in_struct(const std::string& string1,
return concatenator.concatenator(string1, string2);
}

lorem_ipsum::test::optional<Lambdas::Concatenator>
Lambdas::get_concatenator_or_null(const lorem_ipsum::test::optional<std::string>& delimiter)
std::optional<Lambdas::Concatenator>
Lambdas::get_concatenator_or_null(const std::optional<std::string>& delimiter)
{
if (!delimiter) return {};
return {[delimiter](const std::string& string1,
const std::string& string2){ return string1 + *delimiter + string2; }};
}

lorem_ipsum::test::optional<std::string>
std::optional<std::string>
Lambdas::concatenate_or_not(const std::string& string1,
const std::string& string2,
const lorem_ipsum::test::optional<Lambdas::Concatenator>& concatenator)
const std::optional<Lambdas::Concatenator>& concatenator)
{
if (!concatenator) return {};
return (*concatenator)(string1, string2);
Expand Down Expand Up @@ -121,8 +121,8 @@ Lambdas::reset_real_concatenator()
Lambdas::NullableConfuser
Lambdas::get_nullable_confuser()
{
return [](const lorem_ipsum::test::optional<std::string>& value) ->
lorem_ipsum::test::optional<StandaloneProducer>
return [](const std::optional<std::string>& value) ->
std::optional<StandaloneProducer>
{
if (value) {
return { [value] { return *value; } };
Expand All @@ -132,9 +132,9 @@ Lambdas::get_nullable_confuser()
};
}

lorem_ipsum::test::optional<StandaloneProducer>
std::optional<StandaloneProducer>
Lambdas::apply_nullable_confuser(const Lambdas::NullableConfuser& confuser,
const lorem_ipsum::test::optional<std::string>& value)
const std::optional<std::string>& value)
{
return confuser(value);
}
Expand Down
4 changes: 2 additions & 2 deletions functional-tests/functional/input/src/cpp/Locales.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ Locales::locale_round_trip_strip_tag(const Locale& input) {
return Locale(input.language_code, input.country_code, input.script_code);
}

optional<Locale>
Locales::locale_round_trip_nullable(const optional<Locale>& input) {
std::optional<Locale>
Locales::locale_round_trip_nullable(const std::optional<Locale>& input) {
return input;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,26 @@ namespace test
{
using namespace lorem_ipsum::test;

optional<std::vector<std::string>>
UseNullableCollections::nullable_list_round_trip(const optional<std::vector<std::string>>& input) {
std::optional<std::vector<std::string>>
UseNullableCollections::nullable_list_round_trip(const std::optional<std::vector<std::string>>& input) {
return input;
}

optional<std::unordered_set<std::string>>
UseNullableCollections::nullable_set_round_trip(const optional<std::unordered_set<std::string>>& input) {
std::optional<std::unordered_set<std::string>>
UseNullableCollections::nullable_set_round_trip(const std::optional<std::unordered_set<std::string>>& input) {
return input;
}

optional<std::unordered_map<std::string, std::string>>
UseNullableCollections::nullable_map_round_trip(const optional<std::unordered_map<std::string, std::string>>& input) {
std::optional<std::unordered_map<std::string, std::string>>
UseNullableCollections::nullable_map_round_trip(
const std::optional<std::unordered_map<std::string, std::string>>& input
) {
return input;
}

NullableCollections
UseNullableCollections::nullable_collections_round_trip(const NullableCollections& input) {
return input;
}

}
Loading

0 comments on commit 11a2271

Please sign in to comment.