NewLang Project
Yet another programm language
Loading...
Searching...
No Matches
variable.h File Reference
#include "types.h"
#include "dict.h"
#include "rational.h"
Include dependency graph for variable.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  newlang::Sync
 
class  newlang::VariableTaken
 
class  newlang::VirtualFuncImpl< R, Args >
 
class  newlang::VariableOp
 
struct  newlang::VariableShared
 
struct  newlang::VariableWeak
 
struct  newlang::is_shared_ptr< T >
 
struct  newlang::is_shared_ptr< std::shared_ptr< T > >
 
class  newlang::Variable
 

Namespaces

namespace  newlang
 

Macros

#define INCLUDED_VARIABLE_H_
 
#define DEFINE_OPERATOR(name)
 
#define VARIABLE_TYPES(_)
 
#define DEFINE_ENUM(name, value)   name = static_cast<uint8_t>(value),
 
#define MAKE_TYPE_NAME(type_name)   type_name
 
#define DEFINE_CASE(name, _)
 
#define PLACE_RANGE_CHECK_VALUE(itype, utype)
 

Typedefs

typedef std::shared_ptr< Objnewlang::ObjPtr
 
typedef std::shared_ptr< const Objnewlang::ObjPtrConst
 
typedef std::weak_ptr< Objnewlang::ObjWeak
 
typedef std::weak_ptr< const Objnewlang::ObjWeakConst
 
typedef std::shared_ptr< Termnewlang::TermPtr
 
typedef std::shared_ptr< const Termnewlang::TermPtrConst
 
typedef std::shared_ptr< Variablenewlang::VariablePtr
 
typedef std::variant< std::monostate, VariableShared, VariableWeak, VariableTaken, ObjPtr, int64_t, double, std::string, std::wstring, Rationalnewlang::VariableVariant
 

Enumerations

enum class  newlang::RefType : uint8_t {
  newlang::Value = 0 , newlang::Shared = 1 , newlang::LiteSingle = 2 , newlang::LiteThread = 3 ,
  newlang::SyncMono = 4 , newlang::SyncMulti = 5 , newlang::SharedConst = 6 , newlang::LiteSingleConst = 7 ,
  newlang::LiteThreadConst = 8 , newlang::SyncMonoConst = 9 , newlang::SyncMultiConst = 10
}
 
enum class  newlang::VariableCase : uint8_t {
  newlang::DEFINE_ENUM , newlang::EMPTY = static_cast<uint8_t>(0) , newlang::SHARED = static_cast<uint8_t>(1) , newlang::WEAK = static_cast<uint8_t>(2) ,
  newlang::TAKEN = static_cast<uint8_t>(3) , newlang::OBJECT = static_cast<uint8_t>(4) , newlang::INTEGER = static_cast<uint8_t>(5) , newlang::DOUBLE = static_cast<uint8_t>(6) ,
  newlang::STRING = static_cast<uint8_t>(7) , newlang::WSTRING = static_cast<uint8_t>(8) , newlang::RATIONAL = static_cast<uint8_t>(9)
}
 

Functions

std::string newlang::utf8_encode (const std::wstring wstr)
 
std::wstring newlang::utf8_decode (const std::string str)
 
constexpr RefType newlang::RefTypeFromString (const std::string_view text)
 
constexpr bool newlang::isLiteRef (RefType type)
 
constexpr bool newlang::isLiteSyncRef (RefType type)
 
bool newlang::isHeavyRef (RefType type)
 
constexpr bool newlang::isConstRef (RefType type)
 
constexpr bool newlang::isEditableRef (RefType type)
 
constexpr bool newlang::isValidReference (RefType type, RefType test)
 
const char * newlang::VariableCaseToString (size_t index)
 

Macro Definition Documentation

◆ INCLUDED_VARIABLE_H_

#define INCLUDED_VARIABLE_H_

Definition at line 3 of file variable.h.

◆ DEFINE_OPERATOR

#define DEFINE_OPERATOR ( name)
Value:
static OperatorType name; \
static Variable& __ ## name ## __(Variable &self, const Variable &other)

Definition at line 349 of file variable.h.

◆ VARIABLE_TYPES

#define VARIABLE_TYPES ( _)
Value:
_(EMPTY, 0) \
_(SHARED, 1) \
_(WEAK, 2) \
_(TAKEN, 3) \
\
_(OBJECT, 4) \
_(INTEGER, 5) \
_(DOUBLE, 6) \
_(STRING, 7) \
_(WSTRING, 8) \
_(RATIONAL, 9)

Definition at line 403 of file variable.h.

Referenced by newlang::VariableCaseToString().

◆ DEFINE_ENUM

#define DEFINE_ENUM ( name,
value )   name = static_cast<uint8_t>(value),

Definition at line 418 of file variable.h.

◆ MAKE_TYPE_NAME

#define MAKE_TYPE_NAME ( type_name)    type_name

Definition at line 423 of file variable.h.

◆ DEFINE_CASE

#define DEFINE_CASE ( name,
_ )
Value:
case VariableCase:: name : \
return MAKE_TYPE_NAME(":" #name);
#define MAKE_TYPE_NAME(type_name)
Definition variable.h:423

◆ PLACE_RANGE_CHECK_VALUE

#define PLACE_RANGE_CHECK_VALUE ( itype,
utype )
Value:
explicit inline operator itype() const { \
int64_t result = GetValueAsInteger(); \
if (result > std::numeric_limits<itype>::max() || result < std::numeric_limits<itype>::lowest()) { \
LOG_RUNTIME("Value '%s' is out of range of the casting type %s!", toString().c_str(), #itype); \
} \
return result; \
} \
explicit inline operator utype() const { \
int64_t result = GetValueAsInteger(); \
if (result > std::numeric_limits<utype>::max() || result < 0) { \
LOG_RUNTIME("Value '%s' is out of range of the casting type %s!", toString().c_str(), #utype); \
} \
return result; \
}
int result
Definition lexer.l:367
const char * toString(TermID type)
Definition term.h:126

Definition at line 643 of file variable.h.