using namespace std;
+ AsciiFileReader::AsciiFileReader(int fd)
+ : file(fdopen(fd, "r")), buffer(NULL), len(0)
+ {
+ if (file == NULL)
+ {
+ y2war("file is NULL");
+ throw FileNotFoundException();
+ }
+ }
+
+
AsciiFileReader::AsciiFileReader(FILE* file)
: file(file), buffer(NULL), len(0)
{
{
public:
+ AsciiFileReader(int fd);
AsciiFileReader(FILE* file);
AsciiFileReader(const string& filename);
~AsciiFileReader();
}
+ XmlFile::XmlFile(int fd, const string& url)
+ : doc(xmlReadFd(fd, url.c_str(), NULL, XML_PARSE_NOBLANKS | XML_PARSE_NONET))
+ {
+ if (!doc)
+ throw IOErrorException();
+ }
+
+
XmlFile::XmlFile(const string& filename)
: doc(xmlReadFile(filename.c_str(), NULL, XML_PARSE_NOBLANKS | XML_PARSE_NONET))
{
}
+ void
+ XmlFile::save(int fd)
+ {
+ if (xmlDocDump(fdopen(fd, "w"), doc) == -1)
+ throw IOErrorException();
+ }
+
+
void
XmlFile::save(const string& filename)
{
public:
XmlFile();
+ XmlFile(int fd, const string& url);
XmlFile(const string& filename);
~XmlFile();
+ void save(int fd);
void save(const string& filename);
void setRootElement(xmlNode* node)