uri.cpp revision 01d78b8354aa8b6c3629230264d21dc5b5bed01a
/*
* Authors:
* MenTaLguY <mental@rydia.net>
* Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2003 MenTaLguY
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <glib.h>
#include "uri.h"
#include <string>
#include <glibmm/miscutils.h>
#include <iostream>
namespace Inkscape {
}
}
if (!preformed) {
throw MalformedURIException();
}
// One day Inkscape::URI should use std::string by default
// Check for a data URI and parse seperately because
// libxml can't handle this; although svgs need to.
parseDataUri( path );
// Empty the uri for libxml
preformed = "";
}
if (!uri) {
throw MalformedURIException();
}
}
_impl->unreference();
}
// No check for self-assignment needed, as _impl refcounting increments first.
_impl->unreference();
return *this;
}
}
if (_uri) {
}
}
_refcount++;
}
if (!--_refcount) {
delete this;
}
}
return opq;
}
}
bool isNet = false;
if ( isRelative() )
{
}
return isNet;
}
bool isRel = false;
if ( isRelative() )
{
}
return isRel;
}
bool isAbs = false;
if ( isRelative() )
{
}
return isAbs;
}
}
}
}
}
}
{
return filename;
}
/*
* Parse data:... uris so we can access their data transparently.
* otherwise data: is considered a malformed protocol like http:
* and two // as appended and the data is stored in the path of the uri.
*/
data_base64 = false;
unsigned int last_sep = 5;
data_base64 = true;
} else if ( data_mimetype.empty() ) {
} else {
throw BadURIException();
}
}
}
return true;
}
/*
* Returns the data as a decoded byte vector.
*/
if(data_base64) {
}
} else {
// XXX Unimlemented Octet decoding!
}
return result;
}
/*
* Returns the absolute path to an existing file referenced in this URI,
* if the uri is data, the path is empty or the file doesn't exist, then
* an empty string is returned.
*
* Does not check if the returned path is the local document's path (local)
* and thus redundent. Caller is expected to check against the document's path.
*/
// Calculate the absolute path from an available base
}
// Path normalisation should go here TODO
// Check the existance of the file
}
return path;
}
/* TODO !!! proper error handling */
if (isRelativePath()) {
return uriString;
} else {
if (filename) {
return filename;
} else {
throw MalformedURIException();
}
}
}
if ( !path ) {
throw MalformedURIException();
}
for ( int i = 0; path[i]; i++ )
{
|| one == '_'
|| one == '-'
|| one == '!'
|| one == '.'
|| one == '~'
|| one == '\''
|| one == '('
|| one == ')'
|| one == '*'
) {
} else {
}
}
return result;
}
/* TODO !!! proper error handling */
return result;
}
if (string) {
/* hand the string off to glib memory management */
return glib_string;
} else {
return NULL;
}
}
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :