File Validity.h
File List > src > Validity.h
Go to the documentation of this file
// Copyright (c) 2012-2013, IGN France.
// Copyright (c) 2012-2022, Oslandia.
// SPDX-License-Identifier: LGPL-2.0-or-later
#ifndef SFCGAL_VALIDITY_H_
#define SFCGAL_VALIDITY_H_
namespace SFCGAL {
struct Validity {
static const Validity
valid()
{
return Validity();
}
static const Validity
invalid(const std::string &reason)
{
return Validity(reason);
}
operator bool() const { return _valid; }
const std::string &
reason() const
{
return _reason;
}
private:
bool _valid; // not const to allow default copy
std::string _reason;
Validity() : _valid(true) {}
Validity(const std::string &reason) : _valid(false), _reason(reason) {}
};
} // namespace SFCGAL
#endif