Revert "Cleanup: use std::optional instead of custom implementation."
This reverts commit 484ea62a62
.
This commit is contained in:
23
src/3rdparty/optional/LICENSE_1_0.txt
vendored
Normal file
23
src/3rdparty/optional/LICENSE_1_0.txt
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
Boost Software License - Version 1.0 - August 17th, 2003
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person or organization
|
||||||
|
obtaining a copy of the software and accompanying documentation covered by
|
||||||
|
this license (the "Software") to use, reproduce, display, distribute,
|
||||||
|
execute, and transmit the Software, and to prepare derivative works of the
|
||||||
|
Software, and to permit third-parties to whom the Software is furnished to
|
||||||
|
do so, all subject to the following:
|
||||||
|
|
||||||
|
The copyright notices in the Software and this entire statement, including
|
||||||
|
the above license grant, this restriction and the following disclaimer,
|
||||||
|
must be included in all copies of the Software, in whole or in part, and
|
||||||
|
all derivative works of the Software, unless such copies or derivative
|
||||||
|
works are solely in the form of machine-executable object code generated by
|
||||||
|
a source language processor.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||||
|
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||||
|
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
1066
src/3rdparty/optional/optional.hpp
vendored
Normal file
1066
src/3rdparty/optional/optional.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
33
src/3rdparty/optional/ottd_optional.h
vendored
Normal file
33
src/3rdparty/optional/ottd_optional.h
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of OpenTTD.
|
||||||
|
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||||
|
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @file ottd_optional.h Header to select between native. */
|
||||||
|
|
||||||
|
#ifndef OTTD_OPTIONAL_H
|
||||||
|
#define OTTD_OPTIONAL_H
|
||||||
|
|
||||||
|
#if defined(__has_include)
|
||||||
|
# if __has_include(<version>)
|
||||||
|
# include <version>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (__cplusplus >= 201703L) || (defined(__cpp_lib_optional) && __cpp_lib_optional >= 201606L)
|
||||||
|
|
||||||
|
/* Native std::optional. */
|
||||||
|
#include <optional>
|
||||||
|
namespace opt = std;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* No std::optional, use local copy instead. */
|
||||||
|
#include "optional.hpp"
|
||||||
|
namespace opt = std::experimental;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* OTTD_OPTIONAL_H */
|
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include "fileio_type.h"
|
#include "fileio_type.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <optional>
|
#include "3rdparty/optional/ottd_optional.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ enum IniGroupType {
|
|||||||
struct IniItem {
|
struct IniItem {
|
||||||
IniItem *next; ///< The next item in this group
|
IniItem *next; ///< The next item in this group
|
||||||
std::string name; ///< The name of this item
|
std::string name; ///< The name of this item
|
||||||
std::optional<std::string> value; ///< The value of this item
|
opt::optional<std::string> value; ///< The value of this item
|
||||||
std::string comment; ///< The comment associated with this item
|
std::string comment; ///< The comment associated with this item
|
||||||
|
|
||||||
IniItem(struct IniGroup *parent, const std::string &name);
|
IniItem(struct IniGroup *parent, const std::string &name);
|
||||||
|
Reference in New Issue
Block a user