/*! \internal Default constructor initialization must be equivalent to: * memset( this, 0, sizeof(Value) ) * This optimization is used in ValueInternalMap fast allocator. */ Value::Value(ValueType vtype) { static char const emptyString[] = ""; initBasic(vtype); switch (vtype) { case nullValue: break; case intValue: case uintValue: value_.int_ = 0; break; case realValue: value_.real_ = 0.0; break; case stringValue: // allocated_ == false, so this is safe. value_.string_ = const_cast<char*>(static_cast<char const*>(emptyString)); break; case arrayValue: case objectValue: value_.map_ = new ObjectValues(); break; case booleanValue: value_.bool_ = false; break; default: JSON_ASSERT_UNREACHABLE; } }
void EntityTurn::start() { entity.slotBeginTurn(*this); if (not skipped) { initBasic(); while(stack.size()>0) { TurnPhase* phase = stack.top(); stack.pop(); if (phase->canExec(entity)) { phase->exec(entity); } delete phase; } } else { ///\todo entity.onSkip() } entity.slotEndTurn(*this); }
Value::Value(const char* value) { initBasic(stringValue, true); JSON_ASSERT_MESSAGE(value != nullptr, "Null Value Passed to Value Constructor"); value_.string_ = duplicateAndPrefixStringValue( value, static_cast<unsigned>(strlen(value))); }
// Move constructor Value::Value(Value&& other) { initBasic(nullValue); swap(other); }
Value::Value(bool value) { initBasic(booleanValue); value_.bool_ = value; }
Value::Value(const CppTL::ConstString& value) { initBasic(stringValue, true); value_.string_ = duplicateAndPrefixStringValue(value, static_cast<unsigned>(value.length())); }
Value::Value(const StaticString& value) { initBasic(stringValue); value_.string_ = const_cast<char*>(value.c_str()); }
Value::Value(const JSONCPP_STRING& value) { initBasic(stringValue, true); value_.string_ = duplicateAndPrefixStringValue(value.data(), static_cast<unsigned>(value.length())); }
Value::Value(const char* beginValue, const char* endValue) { initBasic(stringValue, true); value_.string_ = duplicateAndPrefixStringValue(beginValue, static_cast<unsigned>(endValue - beginValue)); }
Value::Value(const char* value) { initBasic(stringValue, true); value_.string_ = duplicateAndPrefixStringValue(value, static_cast<unsigned>(strlen(value))); }
Value::Value(double value) { initBasic(realValue); value_.real_ = value; }
Value::Value(UInt64 value) { initBasic(uintValue); value_.uint_ = value; }
Value::Value(Int64 value) { initBasic(intValue); value_.int_ = value; }