示例#1
0
	LightNode::LightNode()
	{
		SetType(System::ObjectType::LIGHT_NODE);
	}
示例#2
0
void JSONValue::SetEmptyObject()
{
    SetType(JSON_OBJECT);
    Clear();
}
示例#3
0
bool JSONValue::Parse(const char*& pos, const char*& end)
{
    char c;

    // Handle comments
    for (;;)
    {
        if (!NextChar(c, pos, end, true))
            return false;

        if (c == '/')
        {
            if (!NextChar(c, pos, end, false))
                return false;
            if (c == '/')
            {
                // Skip until end of line
                if (!MatchChar('\n', pos, end))
                    return false;
            }
            else if (c == '*')
            {
                // Skip until end of comment
                if (!MatchChar('*', pos, end))
                    return false;
                if (!MatchChar('/', pos, end))
                    return false;
            }
            else
                return false;
        }
        else
            break;
    }

    if (c == '}' || c == ']')
        return false;
    else if (c == 'n')
    {
        SetNull();
        return MatchString("ull", pos, end);
    }
    else if (c == 'f')
    {
        *this = false;
        return MatchString("alse", pos, end);
    }
    else if (c == 't')
    {
        *this = true;
        return MatchString("rue", pos, end);
    }
    else if (IsDigit(c) || c == '-')
    {
        --pos;
        *this = strtod(pos, const_cast<char**>(&pos));
        return true;
    }
    else if (c == '\"')
    {
        SetType(JSON_STRING);
        return ReadJSONString(*(reinterpret_cast<String*>(&data)), pos, end, true);
    }
    else if (c == '[')
    {
        SetEmptyArray();
        // Check for empty first
        if (!NextChar(c, pos, end, true))
            return false;
        if (c == ']')
            return true;
        else
            --pos;
        
        for (;;)
        {
            JSONValue arrayValue;
            if (!arrayValue.Parse(pos, end))
                return false;
            Push(arrayValue);
            if (!NextChar(c, pos, end, true))
                return false;
            if (c == ']')
                break;
            else if (c != ',')
                return false;
        }
        return true;
    }
    else if (c == '{')
    {
        SetEmptyObject();
        if (!NextChar(c, pos, end, true))
            return false;
        if (c == '}')
            return true;
        else
            --pos;
        
        for (;;)
        {
            String key;
            if (!ReadJSONString(key, pos, end, false))
                return false;
            if (!NextChar(c, pos, end, true))
                return false;
            if (c != ':')
                return false;
            
            JSONValue objectValue;
            if (!objectValue.Parse(pos, end))
                return false;
            (*this)[key] = objectValue;
            if (!NextChar(c, pos, end, true))
                return false;
            if (c == '}')
                break;
            else if (c != ',')
                return false;
        }
        return true;
    }
    
    return false;
}
示例#4
0
void JSONValue::Insert(size_t index, const JSONValue& value)
{
    SetType(JSON_ARRAY);
    (*(reinterpret_cast<JSONArray*>(&data))).Insert(index, value);
}
示例#5
0
void JSONValue::Insert(const Pair<String, JSONValue>& pair)
{
    SetType(JSON_OBJECT);
    (*(reinterpret_cast<JSONObject*>(&data))).Insert(pair);
}
示例#6
0
JSONValue& JSONValue::operator = (const char* value)
{
    SetType(JSON_STRING);
    *(reinterpret_cast<String*>(&data)) = value;
    return *this;
}
示例#7
0
JSONValue& JSONValue::operator = (const JSONObject& value)
{
    SetType(JSON_OBJECT);
    *(reinterpret_cast<JSONObject*>(&data)) = value;
    return *this;
}
void CNumberEdit::SetRange( short sMin, short sMax )
{
	SetType( ntShort, (long)sMin, (ULONG)sMax );
}
void CNumberEdit::SetRange( USHORT usMin, USHORT usMax )
{
	SetType( ntUShort, (long)usMin, (ULONG)usMax );
}
示例#10
0
void CNumberEdit::SetRange( TCHAR cMin, TCHAR cMax )
{
	SetType( ntChar, (long)cMin, (ULONG)cMax );
}
示例#11
0
void CNumberEdit::SetRange( UCHAR ucMin, UCHAR ucMax )
{
	SetType( ntUChar, (long)ucMin, (ULONG)ucMax );
}
示例#12
0
void SPELRecord::DeleteField(FIELD_IDENTIFIERS)
    {
    SPELSPIT defaultSPIT;
    FNVCTDA defaultCTDA;
    FNVEffect defaultEffect;
    switch(FieldID)
        {
        case 1: //flags1
            SetHeaderFlagMask(0);
            return;
        case 3: //versionControl1
            flagsUnk = 0;
            return;
        case 4: //eid
            EDID.Unload();
            return;
        case 5: //formVersion
            formVersion = 0;
            return;
        case 6: //versionControl2
            versionControl2[0] = 0;
            versionControl2[1] = 0;
            return;
        case 7: //full
            FULL.Unload();
            return;
        case 8: //spellType
            SetType(defaultSPIT.spellType);
            return;
        case 9: //costUnused
            SPIT.value.cost = defaultSPIT.cost;
            return;
        case 10: //levelTypeUnused
            SPIT.value.levelType = defaultSPIT.levelType;
            return;
        case 11: //flags
            SetFlagMask(defaultSPIT.flags);
            return;
        case 12: //unused1
            SPIT.value.unused1[0] = defaultSPIT.unused1[0];
            SPIT.value.unused1[1] = defaultSPIT.unused1[1];
            SPIT.value.unused1[2] = defaultSPIT.unused1[2];
            return;
        case 13: //effects
            if(ListFieldID == 0) //effectsSize
                {
                Effects.Unload();
                return;
                }

            if(ListIndex >= Effects.value.size())
                return;

            switch(ListFieldID)
                {
                case 1: //effect
                    Effects.value[ListIndex]->EFID.value = defaultEffect.EFID.value;
                    return;
                case 2: //magnitude
                    Effects.value[ListIndex]->EFIT.value.magnitude = defaultEffect.EFIT.value.magnitude;
                    return;
                case 3: //area
                    Effects.value[ListIndex]->EFIT.value.area = defaultEffect.EFIT.value.area;
                    return;
                case 4: //duration
                    Effects.value[ListIndex]->EFIT.value.duration = defaultEffect.EFIT.value.duration;
                    return;
                case 5: //rangeType
                    Effects.value[ListIndex]->SetRange(defaultEffect.EFIT.value.rangeType);
                    return;
                case 6: //actorValue
                    Effects.value[ListIndex]->EFIT.value.actorValue = defaultEffect.EFIT.value.actorValue;
                    return;
                case 7: //conditions
                    if(ListX2FieldID == 0) //conditionsSize
                        {
                        Effects.value[ListIndex]->CTDA.Unload();
                        return;
                        }

                    if(ListX2Index >= Effects.value[ListIndex]->CTDA.value.size())
                        return;

                    switch(ListX2FieldID)
                        {
                        case 1: //operType
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->operType = defaultCTDA.operType;
                            return;
                        case 2: //unused1
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->unused1[0] = defaultCTDA.unused1[0];
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->unused1[1] = defaultCTDA.unused1[1];
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->unused1[2] = defaultCTDA.unused1[2];
                            return;
                        case 3: //compValue
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->compValue = defaultCTDA.compValue;
                            return;
                        case 4: //ifunc
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->ifunc = defaultCTDA.ifunc;
                            return;
                        case 5: //param1
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->param1 = defaultCTDA.param1;
                            return;
                        case 6: //param2
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->param2 = defaultCTDA.param2;
                            return;
                        case 7: //runOnType
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->runOnType = defaultCTDA.runOnType;
                            return;
                        case 8: //reference
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->reference = defaultCTDA.reference;
                            return;
                        default:
                            return;
                        }
                    return;
                default:
                    return;
                }
            return;
        default:
            return;
        }
    }
示例#13
0
bool SPELRecord::SetField(FIELD_IDENTIFIERS, void *FieldValue, UINT32 ArraySize)
    {
    switch(FieldID)
        {
        case 1: //flags1
            SetHeaderFlagMask(*(UINT32 *)FieldValue);
            break;
        case 3: //versionControl1
            if(ArraySize != 4)
                break;
            ((UINT8ARRAY)&flagsUnk)[0] = ((UINT8ARRAY)FieldValue)[0];
            ((UINT8ARRAY)&flagsUnk)[1] = ((UINT8ARRAY)FieldValue)[1];
            ((UINT8ARRAY)&flagsUnk)[2] = ((UINT8ARRAY)FieldValue)[2];
            ((UINT8ARRAY)&flagsUnk)[3] = ((UINT8ARRAY)FieldValue)[3];
            break;
        case 4: //eid
            EDID.Copy((STRING)FieldValue);
            break;
        case 5: //formVersion
            formVersion = *(UINT16 *)FieldValue;
            break;
        case 6: //versionControl2
            if(ArraySize != 2)
                break;
            versionControl2[0] = ((UINT8ARRAY)FieldValue)[0];
            versionControl2[1] = ((UINT8ARRAY)FieldValue)[1];
            break;
        case 7: //full
            FULL.Copy((STRING)FieldValue);
            break;
        case 8: //spellType
            SetType(*(UINT32 *)FieldValue);
            break;
        case 9: //costUnused
            SPIT.value.cost = *(UINT32 *)FieldValue;
            break;
        case 10: //levelTypeUnused
            SPIT.value.levelType = *(UINT32 *)FieldValue;
            break;
        case 11: //flags
            SetFlagMask(*(UINT8 *)FieldValue);
            break;
        case 12: //unused1
            if(ArraySize != 3)
                break;
            SPIT.value.unused1[0] = ((UINT8ARRAY)FieldValue)[0];
            SPIT.value.unused1[1] = ((UINT8ARRAY)FieldValue)[1];
            SPIT.value.unused1[2] = ((UINT8ARRAY)FieldValue)[2];
            break;
        case 13: //effects
            if(ListFieldID == 0) //effectsSize
                {
                Effects.resize(ArraySize);
                return false;
                }

            if(ListIndex >= Effects.value.size())
                break;

            switch(ListFieldID)
                {
                case 1: //effect
                    Effects.value[ListIndex]->EFID.value = *(FORMID *)FieldValue;
                    return true;
                case 2: //magnitude
                    Effects.value[ListIndex]->EFIT.value.magnitude = *(UINT32 *)FieldValue;
                    break;
                case 3: //area
                    Effects.value[ListIndex]->EFIT.value.area = *(UINT32 *)FieldValue;
                    break;
                case 4: //duration
                    Effects.value[ListIndex]->EFIT.value.duration = *(UINT32 *)FieldValue;
                    break;
                case 5: //rangeType
                    Effects.value[ListIndex]->SetRange(*(UINT32 *)FieldValue);
                    break;
                case 6: //actorValue
                    Effects.value[ListIndex]->EFIT.value.actorValue = *(SINT32 *)FieldValue;
                    break;
                case 7: //conditions
                    if(ListX2FieldID == 0) //conditionsSize
                        {
                        Effects.value[ListIndex]->CTDA.resize(ArraySize);
                        return false;
                        }

                    if(ListX2Index >= Effects.value[ListIndex]->CTDA.value.size())
                        break;

                    switch(ListX2FieldID)
                        {
                        case 1: //operType
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->operType = *(UINT8 *)FieldValue;
                            break;
                        case 2: //unused1
                            if(ArraySize != 3)
                                break;
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->unused1[0] = ((UINT8ARRAY)FieldValue)[0];
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->unused1[1] = ((UINT8ARRAY)FieldValue)[1];
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->unused1[2] = ((UINT8ARRAY)FieldValue)[2];
                            break;
                        case 3: //compValue
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->compValue = *(FORMID_OR_FLOAT32 *)FieldValue;
                            return true;
                        case 4: //ifunc
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->ifunc = *(UINT32 *)FieldValue;
                            return true;
                        case 5: //param1
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->param1 = *(FORMID_OR_UINT32 *)FieldValue;
                            return true;
                        case 6: //param2
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->param2 = *(FORMID_OR_UINT32 *)FieldValue;
                            return true;
                        case 7: //runOnType
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->runOnType = *(UINT32 *)FieldValue;
                            return true;
                        case 8: //reference
                            Effects.value[ListIndex]->CTDA.value[ListX2Index]->reference = *(FORMID_OR_UINT32 *)FieldValue;
                            return true;
                        default:
                            break;
                        }
                    break;
                default:
                    break;
                }
            break;
        default:
            break;
        }
    return false;
    }
示例#14
0
void
InfoBoxManager::SetCurrentType(unsigned box, char type)
{
  SetType(box, type, GetCurrentMode());
}
示例#15
0
JSONValue& JSONValue::operator = (bool rhs)
{
    SetType(JSON_BOOL);
    data.boolValue = rhs;
    return *this;
}
示例#16
0
void CNumberEdit::SetRange( long lMin, long lMax )
{
	SetType( ntLong, (long)lMin, (ULONG)lMax );
}
示例#17
0
JSONValue& JSONValue::operator = (double rhs)
{
    SetType(JSON_NUMBER);
    data.numberValue = rhs;
    return *this;
}
示例#18
0
void CNumberEdit::SetRange( double dMin, double dMax )
{
	SetType( ntDouble, dMin, dMax );
}
示例#19
0
JSONValue& JSONValue::operator = (const JSONArray& value)
{
    SetType(JSON_ARRAY);
    *(reinterpret_cast<JSONArray*>(&data)) = value;
    return *this;
}
示例#20
0
KVSeDPositionCal::KVSeDPositionCal() : KVCalibrator(NPAR_SEDPOSCAL)
{
   // Default constructor
   SetType("position->cm");
   SetLabel("XY");
}
示例#21
0
void JSONValue::Push(const JSONValue& value)
{
    SetType(JSON_ARRAY);
    (*(reinterpret_cast<JSONArray*>(&data))).Push(value);
}
示例#22
0
文件: rect.cpp 项目: Dingf/Paper-TD
Rect::Rect(Float left, Float top, Float right, Float bottom)
{
	SetType(SHAPE_TYPE_RECT);
	SetValues(left, top, right, bottom);
}
示例#23
0
void JSONValue::Resize(size_t newSize)
{
    SetType(JSON_ARRAY);
    (*(reinterpret_cast<JSONArray*>(&data))).Resize(newSize);
}
示例#24
0
文件: rect.cpp 项目: Dingf/Paper-TD
Rect::Rect(const Point2D& topLeft, const Point2D& bottomRight)
{
	SetType(SHAPE_TYPE_RECT);
	SetValues(topLeft.GetX(), topLeft.GetY(), bottomRight.GetX(), bottomRight.GetY());
}
示例#25
0
void JSONValue::SetEmptyArray()
{
    SetType(JSON_ARRAY);
    Clear();
}
示例#26
0
文件: rect.cpp 项目: Dingf/Paper-TD
Rect::Rect(const Rect& r)
{
	SetType(SHAPE_TYPE_RECT);
	*this = r;
}
示例#27
0
void JSONValue::SetNull()
{
    SetType(JSON_NULL);
}
示例#28
0
文件: rect.cpp 项目: Dingf/Paper-TD
Rect::Rect()
{
	SetType(SHAPE_TYPE_RECT);
	SetValues(0, 0, 0, 0);
}
示例#29
0
JSONValue::~JSONValue()
{
    SetType(JSON_NULL);
}
示例#30
0
void C4ParticleValueProvider::Set(float to)
{
	SetType(C4PV_Const);
	startValue = endValue = to;
}