From 179fa413b047bede6e32109e2ce82437c5fb8d34 Mon Sep 17 00:00:00 2001 From: MenTaLguY Date: Mon, 16 Jan 2006 02:36:01 +0000 Subject: moving trunk for module inkscape (bzr r1) --- src/streams-handles.cpp | 119 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 src/streams-handles.cpp (limited to 'src/streams-handles.cpp') diff --git a/src/streams-handles.cpp b/src/streams-handles.cpp new file mode 100644 index 000000000..0990d0589 --- /dev/null +++ b/src/streams-handles.cpp @@ -0,0 +1,119 @@ +/* + * IO layer : handles for URIs + * + * Authors: + * Johan Ceuppens + * + * Copyright (C) 2004 Johan Ceuppens + * + * Released under GNU LGPL, read the file 'COPYING.LIB' for more information + */ + +#include "streams-handles.h" +#include "uri.h" + +#include + +namespace Inkscape { + +/** + * FileHandle + */ + +int FileHandle::open(URI const& uri, char const* mode) +{ + if (sys_open(uri, mode) == 0) + return 0; + else + return 1; +} + +FILE *FileHandle::sys_open(URI const& uri, char const* mode) +{ + gchar *filename = uri.toNativeFilename(); + + if ((fp = std::fopen(filename, mode)) == 0) { + error("fopen"); + } +#ifdef DEBUG_STREAMS + std::cout<<"file opened fp="<