patrick
/
plasp
Archived
1
0
Fork 0
This repository has been archived on 2023-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
plasp/include/plasp/sas/Value.h

76 lines
1.5 KiB
C
Raw Normal View History

#ifndef __PLASP__SAS__VALUE_H
#define __PLASP__SAS__VALUE_H
2016-05-20 15:29:24 +02:00
#include <iosfwd>
2016-05-20 15:29:24 +02:00
#include <string>
2016-05-21 15:54:03 +02:00
#include <vector>
2016-05-20 15:29:24 +02:00
2017-05-12 14:17:57 +02:00
#include <tokenize/Tokenizer.h>
#include <colorlog/ColorStream.h>
2016-05-20 15:29:24 +02:00
namespace plasp
{
namespace sas
{
2016-05-21 17:09:55 +02:00
// Forward declarations
class Variable;
2016-05-20 15:29:24 +02:00
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Value
//
////////////////////////////////////////////////////////////////////////////////////////////////////
struct Value;
using Values = std::vector<Value>;
////////////////////////////////////////////////////////////////////////////////////////////////////
2016-05-20 15:29:24 +02:00
struct Value
{
2016-05-21 16:22:40 +02:00
public:
enum class Sign
{
Positive,
Negative
};
2016-05-21 16:22:40 +02:00
static const Value Any;
static const Value None;
2016-05-20 15:29:24 +02:00
2017-05-12 14:17:57 +02:00
static Value fromSAS(tokenize::Tokenizer<> &tokenizer);
static const Value &referenceFromSAS(tokenize::Tokenizer<> &tokenizer, const Variable &variable);
2016-05-20 15:29:24 +02:00
2016-05-21 16:22:40 +02:00
public:
Value negated() const;
void printAsSAS(colorlog::ColorStream &stream) const;
void printAsASPPredicate(colorlog::ColorStream &stream) const;
2016-05-20 15:29:24 +02:00
2016-05-21 16:22:40 +02:00
Sign sign() const;
const std::string &name() const;
private:
static const Value reserved(const std::string &name);
2016-05-21 16:22:40 +02:00
private:
Value();
Sign m_sign;
std::string m_name;
bool m_hasArguments;
2016-05-21 16:22:40 +02:00
};
2016-05-21 15:54:03 +02:00
////////////////////////////////////////////////////////////////////////////////////////////////////
bool operator ==(const Value &value1, const Value &value2);
////////////////////////////////////////////////////////////////////////////////////////////////////
2016-05-20 15:29:24 +02:00
}
}
#endif