Page MenuHome GnuPG

attachment.cpp
No OneTemporary

attachment.cpp

/* attachment.cpp - Functions for attachment handling
* Copyright (C) 2005, 2007 g10 Code GmbH
* Copyright (C) 2015 Intevation GmbH
*
* This file is part of GpgOL.
*
* GpgOL is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* GpgOL 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "common_indep.h"
#include "attachment.h"
#include <climits>
Attachment::Attachment()
{
}
Attachment::~Attachment()
{
log_debug ("%s:%s", SRCNAME, __func__);
}
std::string
Attachment::get_display_name() const
{
return m_utf8DisplayName;
}
void
Attachment::set_display_name(const char *name)
{
m_utf8DisplayName = std::string(name);
}
void
Attachment::set_attach_type(attachtype_t type)
{
m_type = type;
}
GpgME::Data &
Attachment::get_data()
{
return m_data;
}
const std::string &
Attachment::get_data_string()
{
if (!m_data_string.empty())
{
return m_data_string;
}
char buf[4096];
m_data.seek (0, SEEK_SET);
size_t nread;
m_data_string = std::string();
while ((nread = m_data.read (buf, 4096)) > 0)
{
m_data_string += std::string(buf, nread);
}
return m_data_string;
}

File Metadata

Mime Type
text/x-c
Expires
Tue, Sep 16, 12:02 PM (1 d, 22 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
51/57/f98e0e4f8a6346baa8076c1d9b5a

Event Timeline