Beispiel #1
0
TTime DateTimeToSymbian(datetime_t Time)
{
  	// reference is 1st January 2001 00:00:00.000 UTC
    TTime Reference(ToInt64(LL(0x00e05776f452a000)));
    TTimeIntervalSeconds Diff;
    Diff = Time;
	return Reference + Diff;
}
Beispiel #2
0
datetime_t SymbianToDateTime(TTime Time)
{
    // reference is 1st January 2001 00:00:00.000 UTC
	datetime_t Date = INVALID_DATETIME_T;
    TTime Reference(ToInt64(LL(0x00e05776f452a000)));
    TTimeIntervalSeconds Diff;

    if (Time.SecondsFrom(Reference,Diff) == KErrNone)
	{
		Date = Diff.Int();
		if (Date==INVALID_DATETIME_T) ++Date;
	}

	return Date;
}
Beispiel #3
0
UINT64 IniInt64Value(LIST *o, char *key)
{
	INI_ENTRY *e;
	// 引数チェック
	if (o == NULL || key == NULL)
	{
		return 0;
	}

	e = GetIniEntry(o, key);
	if (e == NULL)
	{
		return 0;
	}

	return ToInt64(e->Value);
}
Beispiel #4
0
long long XMLElement::GetInt64(const ea::string& name) const
{
    return ToInt64(GetAttribute(name));
}
Beispiel #5
0
void Variant::FromString(VariantType type, const char* value)
{
    switch (type)
    {
    case VAR_INT:
        *this = ToInt(value);
        break;

    case VAR_INT64:
        *this = ToInt64(value);
        break;

    case VAR_BOOL:
        *this = ToBool(value);
        break;

    case VAR_FLOAT:
        *this = ToFloat(value);
        break;

    case VAR_VECTOR2:
        *this = ToVector2(value);
        break;

    case VAR_VECTOR3:
        *this = ToVector3(value);
        break;

    case VAR_VECTOR4:
        *this = ToVector4(value);
        break;

    case VAR_QUATERNION:
        *this = ToQuaternion(value);
        break;

    case VAR_COLOR:
        *this = ToColor(value);
        break;

    case VAR_STRING:
        *this = value;
        break;

    case VAR_BUFFER:
    {
        SetType(VAR_BUFFER);
        PODVector<unsigned char>& buffer = *(reinterpret_cast<PODVector<unsigned char>*>(&value_));
        StringToBuffer(buffer, value);
    }
        break;

    case VAR_VOIDPTR:
        // From string to void pointer not supported, set to null
        *this = (void*)0;
        break;

    case VAR_RESOURCEREF:
    {
        StringVector values = String::Split(value, ';');
        if (values.Size() == 2)
        {
            SetType(VAR_RESOURCEREF);
            ResourceRef& ref = *(reinterpret_cast<ResourceRef*>(&value_));
            ref.type_ = values[0];
            ref.name_ = values[1];
        }
    }
        break;

    case VAR_RESOURCEREFLIST:
    {
        StringVector values = String::Split(value, ';', true);
        if (values.Size() >= 1)
        {
            SetType(VAR_RESOURCEREFLIST);
            ResourceRefList& refList = *(reinterpret_cast<ResourceRefList*>(&value_));
            refList.type_ = values[0];
            refList.names_.Resize(values.Size() - 1);
            for (unsigned i = 1; i < values.Size(); ++i)
                refList.names_[i - 1] = values[i];
        }
    }
        break;

    case VAR_INTRECT:
        *this = ToIntRect(value);
        break;

    case VAR_INTVECTOR2:
        *this = ToIntVector2(value);
        break;

    case VAR_INTVECTOR3:
        *this = ToIntVector3(value);
        break;

    case VAR_PTR:
        // From string to RefCounted pointer not supported, set to null
        *this = (RefCounted*)0;
        break;

    case VAR_MATRIX3:
        *this = ToMatrix3(value);
        break;

    case VAR_MATRIX3X4:
        *this = ToMatrix3x4(value);
        break;

    case VAR_MATRIX4:
        *this = ToMatrix4(value);
        break;

    case VAR_DOUBLE:
        *this = ToDouble(value);
        break;

    case VAR_RECT:
        *this = ToRect(value);
        break;

    default:
        SetType(VAR_NONE);
    }
}
int64 ReceivedMessageArgument::AsInt64Unchecked() const
{
    return ToInt64( argument_ );
}
Beispiel #7
0
// Read the text stream
bool CfgReadNextTextBUF(BUF *b, FOLDER *current)
{
	char *buf;
	TOKEN_LIST *token;
	char *name;
	char *string;
	char *data;
	bool ret;
	FOLDER *f;

	// Validate arguments
	if (b == NULL || current == NULL)
	{
		return false;
	}

	ret = true;

	// Read one line
	buf = CfgReadNextLine(b);
	if (buf == NULL)
	{
		return false;
	}

	// Analyze this line
	token = ParseToken(buf, "\t ");
	if (token == NULL)
	{
		Free(buf);
		return false;
	}

	if (token->NumTokens >= 1)
	{
		if (!StrCmpi(token->Token[0], TAG_DECLARE))
		{
			if (token->NumTokens >= 2)
			{
				// declare
				name = CfgUnescape(token->Token[1]);

				// Create a folder
				f = CfgCreateFolder(current, name);

				// Read the next folder
				while (true)
				{
					if (CfgReadNextTextBUF(b, f) == false)
					{
						break;
					}
				}

				Free(name);
			}
		}
		if (!StrCmpi(token->Token[0], "}"))
		{
			// end
			ret = false;
		}
		if (token->NumTokens >= 3)
		{
			name = CfgUnescape(token->Token[1]);
			data = token->Token[2];

			if (!StrCmpi(token->Token[0], TAG_STRING))
			{
				// string
				wchar_t *uni;
				UINT uni_size;
				string = CfgUnescape(data);
				uni_size = CalcUtf8ToUni(string, StrLen(string));
				if (uni_size != 0)
				{
					uni = Malloc(uni_size);
					Utf8ToUni(uni, uni_size, string, StrLen(string));
					CfgAddUniStr(current, name, uni);
					Free(uni);
				}
				Free(string);
			}
			if (!StrCmpi(token->Token[0], TAG_INT))
			{
				// uint
				CfgAddInt(current, name, ToInt(data));
			}
			if (!StrCmpi(token->Token[0], TAG_INT64))
			{
				// uint64
				CfgAddInt64(current, name, ToInt64(data));
			}
			if (!StrCmpi(token->Token[0], TAG_BOOL))
			{
				// bool
				bool b = false;
				if (!StrCmpi(data, TAG_TRUE))
				{
					b = true;
				}
				else if (ToInt(data) != 0)
				{
					b = true;
				}
				CfgAddBool(current, name, b);
			}
			if (!StrCmpi(token->Token[0], TAG_BYTE))
			{
				// byte
				char *unescaped_b64 = CfgUnescape(data);
				void *tmp = Malloc(StrLen(unescaped_b64) * 4 + 64);
				int size = B64_Decode(tmp, unescaped_b64, StrLen(unescaped_b64));
				CfgAddByte(current, name, tmp, size);
				Free(tmp);
				Free(unescaped_b64);
			}

			Free(name);
		}
	}

	// Release of the token
	FreeToken(token);

	Free(buf);

	return ret;
}
Beispiel #8
0
DateTime zDBBinaryReader::ToDateTime(int offset)
{
	CHECK_DISPOSED(m_disposed);
	return DateTime(ToInt64(offset));		// Use ToInt64() instead
}