Exemplo n.º 1
0
//----------------------------------------------------------------------------------------
nsresult nsFileSpec::MoveToDir(const nsFileSpec& inNewParentDirectory)
//----------------------------------------------------------------------------------------
{
    // We can only copy into a directory, and (for now) can not copy entire directories
    nsresult result = NS_FILE_FAILURE;

    if (inNewParentDirectory.IsDirectory() && !IsDirectory())
    {
        char *leafname = GetLeafName();
        nsSimpleCharString destPath(inNewParentDirectory.GetCString());
        destPath += "/";
        destPath += leafname;
        nsCRT::free(leafname);

        result = NS_FILE_RESULT(CrudeFileCopy(GetCString(), (const char*)destPath));
        if (result == NS_OK)
        {
            // cast to fix const-ness
            ((nsFileSpec*)this)->Delete(PR_FALSE);
        
            *this = inNewParentDirectory + GetLeafName(); 
        }
    }
    return result;
} 
Exemplo n.º 2
0
Variant JSONValue::GetVariantValue(unsigned index, VariantType type) const
{
    Variant ret;

    if (type == VAR_RESOURCEREF)
        ret = GetResourceRef(index);
    else if (type == VAR_RESOURCEREFLIST)
        ret = GetResourceRefList(index);
    else if (type == VAR_VARIANTVECTOR || type == VAR_VARIANTMAP)
        LOGERROR("Unsupported value type");
    else
        ret.FromString(type, GetCString(index));

    return ret;
}
Exemplo n.º 3
0
//----------------------------------------------------------------------------------------
nsresult nsFileSpec::CopyToDir(const nsFileSpec& inParentDirectory) const
//----------------------------------------------------------------------------------------
{
    // We can only copy into a directory, and (for now) can not copy entire directories
    nsresult result = NS_FILE_FAILURE;

    if (inParentDirectory.IsDirectory() && (! IsDirectory() ) )
    {
        char *leafname = GetLeafName();
        nsSimpleCharString destPath(inParentDirectory.GetCString());
        destPath += "/";
        destPath += leafname;
        nsCRT::free(leafname);
        result = NS_FILE_RESULT(CrudeFileCopy(GetCString(), destPath));
    }
    return result;
} // nsFileSpec::CopyToDir
Exemplo n.º 4
0
//----------------------------------------------------------------------------------------
nsresult nsFileSpec::CopyToDir(const nsFileSpec& inParentDirectory) const
//----------------------------------------------------------------------------------------
{
    // We can only copy into a directory, and (for now) can not copy entire directories
    if (inParentDirectory.IsDirectory() && (! IsDirectory() ) )
    {
        char *leafname = GetLeafName();
        nsSimpleCharString destPath(inParentDirectory.GetCString());
        destPath += "\\";
        destPath += leafname;
        nsCRT::free(leafname);
        
        // CopyFile returns non-zero if succeeds
        int copyOK = CopyFile(GetCString(), destPath, PR_TRUE);
        if (copyOK)
            return NS_OK;
    }
    return NS_FILE_FAILURE;
} // nsFileSpec::CopyToDir
Exemplo n.º 5
0
Variant JSONValue::GetVectorVariant(unsigned index) const
{
    return ToVectorVariant(GetCString(index));
}
Exemplo n.º 6
0
Matrix4 JSONValue::GetMatrix4(unsigned index) const
{
    return ToMatrix4(GetCString(index));
}
Exemplo n.º 7
0
Quaternion JSONValue::GetQuaternion(const String& name) const
{
    return ToQuaternion(GetCString(name));
}
Exemplo n.º 8
0
IntRect JSONValue::GetIntRect(unsigned index) const
{
    return ToIntRect(GetCString(index));
}
Exemplo n.º 9
0
IntVector2 JSONValue::GetIntVector2(unsigned index) const
{
    return ToIntVector2(GetCString(index));
}
Exemplo n.º 10
0
Color JSONValue::GetColor(unsigned index) const
{
    return ToColor(GetCString(index));
}
Exemplo n.º 11
0
PODVector<unsigned char> JSONValue::GetBuffer(unsigned index) const
{
    PODVector<unsigned char> buffer;
    StringToBuffer(buffer, GetCString(index));
    return buffer;
}
Exemplo n.º 12
0
Color JSONValue::GetColor(const String& name) const
{
    return ToColor(GetCString(name));
}
Exemplo n.º 13
0
Variant JSONValue::GetVectorVariant(const String& name) const
{
    return ToVectorVariant(GetCString(name));
}
Exemplo n.º 14
0
Vector4 JSONValue::GetVector4(unsigned index) const
{
    return ToVector4(GetCString(index));
}
Exemplo n.º 15
0
Matrix4 JSONValue::GetMatrix4(const String& name) const
{
    return ToMatrix4(GetCString(name));
}
Exemplo n.º 16
0
IntVector2 JSONValue::GetIntVector2(const String& name) const
{
    return ToIntVector2(GetCString(name));
}
Exemplo n.º 17
0
IntRect JSONValue::GetIntRect(const String& name) const
{
    return ToIntRect(GetCString(name));
}
Exemplo n.º 18
0
PODVector<unsigned char> JSONValue::GetBuffer(const String& name) const
{
    PODVector<unsigned char> buffer;
    StringToBuffer(buffer, GetCString(name));
    return buffer;
}
Exemplo n.º 19
0
Quaternion JSONValue::GetQuaternion(unsigned index) const
{
    return ToQuaternion(GetCString(index));
}
Exemplo n.º 20
0
Vector4 JSONValue::GetVector4(const String& name) const
{
    return ToVector4(GetCString(name));
}