webengine/osswebengine/WebCore/platform/symbian/KURLSymbian.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "config.h"
       
    21 #include "KURL.h"
       
    22 #include <string.h>
       
    23 #include <wtf/Assertions.h>
       
    24 #include <wtf/Vector.h>
       
    25 
       
    26 using namespace WebCore;
       
    27 
       
    28 KURL::KURL( const TDesC8& aUrl )
       
    29 {
       
    30     TInt bytesLength(aUrl.Length());
       
    31     if (bytesLength ) {
       
    32         Vector<char, 2048> buffer(bytesLength + 6);  // 5 for "file:", 1 for NUL terminator
       
    33         char *bytes = &buffer[5];
       
    34         memcpy(bytes, aUrl.Ptr(), bytesLength);
       
    35         bytes[bytesLength] = '\0';
       
    36         if (bytes[0] == '/') {
       
    37             buffer[0] = 'f';
       
    38             buffer[1] = 'i';
       
    39             buffer[2] = 'l';
       
    40             buffer[3] = 'e';
       
    41             buffer[4] = ':';
       
    42             parse(buffer.data(), 0);
       
    43         } else
       
    44             parse(bytes, 0);
       
    45     } else
       
    46         parse("", 0);
       
    47 }
       
    48 
       
    49 TPtrC8 KURL::des() const
       
    50 {
       
    51     return urlString.des8();
       
    52 }