/usr/include/barry18/barry/mimeio.h is in libbarry-dev 0.18.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | ///
/// \file mimeio.h
/// Storage, parser, builder classes for MIME objects
/// (vcard, vevent, vtodo, vjournal)
///
/*
Copyright (C) 2010-2013, Net Direct Inc. (http://www.netdirect.ca/)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the
root directory of this project for more details.
*/
#ifndef __BARRY_MIMEIO_H__
#define __BARRY_MIMEIO_H__
#include "dll.h"
#include "builder.h"
#include "vcard.h"
#include "vevent.h"
#include "vjournal.h"
#include "vtodo.h"
#include <string>
#include <vector>
#include <memory>
#include <iostream>
namespace Barry {
class Contact;
class Calendar;
class CalendarAll;
class Memo;
class Task;
//
// Template classes to write MIME data to stream, from record.
//
template <class Record>
class MimeDump
{
public:
static void Dump(std::ostream &os, const Record &rec)
{
os << rec << std::endl;
}
static bool Supported() { return false; }
};
template <>
class MimeDump<Barry::Contact>
{
public:
static void Dump(std::ostream &os, const Barry::Contact &rec)
{
Barry::Sync::vCard vcard;
os << vcard.ToVCard(rec) << std::endl;
}
static bool Supported() { return true; }
};
template <>
class MimeDump<Barry::Calendar>
{
public:
static void Dump(std::ostream &os, const Barry::Calendar &rec)
{
Barry::Sync::vTimeConverter vtc;
Barry::Sync::vCalendar vcal(vtc);
os << vcal.ToVCal(rec) << std::endl;
}
static bool Supported() { return true; }
};
template <>
class MimeDump<Barry::CalendarAll>
{
public:
static void Dump(std::ostream &os, const Barry::CalendarAll &rec)
{
Barry::Sync::vTimeConverter vtc;
Barry::Sync::vCalendar vcal(vtc);
os << vcal.ToVCal(rec) << std::endl;
}
static bool Supported() { return true; }
};
template <>
class MimeDump<Barry::Memo>
{
public:
static void Dump(std::ostream &os, const Barry::Memo &rec)
{
Barry::Sync::vTimeConverter vtc;
Barry::Sync::vJournal vjournal(vtc);
os << vjournal.ToMemo(rec) << std::endl;
}
static bool Supported() { return true; }
};
template <>
class MimeDump<Barry::Task>
{
public:
static void Dump(std::ostream &os, const Barry::Task &rec)
{
Barry::Sync::vTimeConverter vtc;
Barry::Sync::vTodo vtodo(vtc);
os << vtodo.ToTask(rec) << std::endl;
}
static bool Supported() { return true; }
};
//
// Builder class, for reading MIME stream data and loading into
// a DBData record.
//
class BXEXPORT MimeBuilder : public Barry::Builder
{
std::auto_ptr<std::ifstream> m_ifs;
std::istream &m_is;
public:
explicit MimeBuilder(const std::string &filename);
explicit MimeBuilder(std::istream &is);
bool BuildRecord(DBData &data, size_t &offset, const IConverter *ic);
bool FetchRecord(DBData &data, const IConverter *ic);
bool EndOfFile() const;
// return false at end of file, true if a record was read
static bool ReadMimeRecord(std::istream &is, std::string &vrec,
std::vector<std::string> &types);
// returns true if item is a member of types, doing a
// case-insensitive compare
static bool IsMember(const std::string &item,
const std::vector<std::string> &types);
};
}
#endif
|