Example #1
0
 /**
  * Constructs a Hash type.
  * @param key_type The key type of the hash.  Defaults to the Scalar type.
  * @param element_type The element type of the hash.  Defaults to the Data type.
  * @param from The "from" type parameter.
  * @param to The "to" type parameter.
  */
 explicit basic_hash(Type key_type = scalar(), Type element_type = data(), int64_t from = std::numeric_limits<int64_t>::min(), int64_t to = std::numeric_limits<int64_t>::max()) :
     _key_type(rvalue_cast(key_type)),
     _element_type(rvalue_cast(element_type)),
     _from(from),
     _to(to)
 {
 }
Example #2
0
 T mutate_as(value& v)
 {
     // Check for variable first
     if (boost::get<variable>(&v)) {
         return boost::get<T>(dereference(v));
     }
     // Move the value
     return rvalue_cast(boost::get<T>(v));
 }
Example #3
0
 T move_as()
 {
     if (auto var = boost::get<variable>(this)) {
         value copy = var->value();
         return copy.move_as<T>();
     }
     // Move this value
     return rvalue_cast(boost::get<T>(*this));
 }
Example #4
0
 /**
  * Constructs a Struct type.
  * @param types The types that make up the struct.
  */
 explicit basic_struct(std::unordered_map<std::string, Type> types = std::unordered_map<std::string, Type>()) :
     _types(rvalue_cast(types))
 {
 }
Example #5
0
 val(T&& obj) : _obj(rvalue_cast(obj)) {}
Example #6
0
 /**
  * Constructs a Variant type.
  * @param types The types that make up the variant.
  */
 explicit basic_variant(std::vector<Type> types = std::vector<Type>()) :
     _types(rvalue_cast(types))
 {
 }
Example #7
0
 /**
  * Constructs a lexer exception.
  * @param message The lexer exception message.
  * @param begin The beginning iterator where lexing failed.
  * @param end The ending iterator (exclusive) where lexing failed.
  */
 lexer_exception(std::string const& message, Iterator begin, Iterator end) :
     std::runtime_error(message),
     _begin(rvalue_cast(begin)),
     _end(rvalue_cast(end))
 {
 }
Example #8
0
 parse_exception(boost::spirit::x3::expectation_failure<Iterator> const& ex, lexer::position begin, lexer::position end) :
     parse_exception(format_message(ex.which(), static_cast<lexer::token_id>(ex.where()->id())), rvalue_cast(begin), rvalue_cast(end))
 {
 }
Example #9
0
 ActionMap &addMap(std::string key)
 {
     auto ret = std::make_shared<ActionMap>(key, this);
     add(rvalue_cast(key), ret);
     return *ret;
 }
Example #10
0
 Type &addAction(std::string key = Type::title())
 {
     auto ret = std::make_shared<Type>(key, this);
     add(rvalue_cast(key), ret);
     return *ret;
 }
Example #11
0
 ActionMap(std::string id = "", ActionMap *parent = nullptr) : ActionElement(rvalue_cast(id), parent) {}
Example #12
0
 value& operator=(T&& value)
 {
     value_base::operator=(rvalue_cast(value));
     return *this;
 }
Example #13
0
 value(T&& value) noexcept :
     value_base(rvalue_cast(value))
 {
 }