2013-02-07 18:56:07 +01:00
|
|
|
// Copyright (c) 2013, Thomas Goyne <plorkyeran@aegisub.org>
|
2006-06-30 22:56:16 +02:00
|
|
|
//
|
2013-02-07 18:56:07 +01:00
|
|
|
// Permission to use, copy, modify, and distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice appear in all copies.
|
2006-06-30 22:56:16 +02:00
|
|
|
//
|
2013-02-07 18:56:07 +01:00
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
2006-06-30 22:56:16 +02:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
|
|
|
|
2013-01-04 16:01:50 +01:00
|
|
|
#include "ass_entry.h"
|
|
|
|
|
|
|
|
#include <libaegisub/fs_fwd.h>
|
|
|
|
|
2013-02-07 18:56:07 +01:00
|
|
|
#include <boost/flyweight.hpp>
|
2006-07-01 00:44:42 +02:00
|
|
|
#include <vector>
|
2006-06-30 22:56:16 +02:00
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
/// @class AssAttachment
|
2014-03-08 02:13:23 +01:00
|
|
|
class AssAttachment : public AssEntry {
|
2013-02-07 18:56:07 +01:00
|
|
|
/// ASS uuencoded entry data, including header.
|
|
|
|
boost::flyweight<std::string> entry_data;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-12-22 22:15:28 +01:00
|
|
|
/// Name of the attached file, with SSA font mangling if it is a ttf
|
2013-02-07 18:56:07 +01:00
|
|
|
boost::flyweight<std::string> filename;
|
2006-06-30 23:21:30 +02:00
|
|
|
|
2012-11-25 01:08:29 +01:00
|
|
|
AssEntryGroup group;
|
|
|
|
|
2006-06-30 22:56:16 +02:00
|
|
|
public:
|
2011-12-22 22:15:28 +01:00
|
|
|
/// Get the size of the attached file in bytes
|
2013-02-07 18:56:07 +01:00
|
|
|
size_t GetSize() const;
|
2006-06-30 23:21:30 +02:00
|
|
|
|
2013-02-07 18:56:07 +01:00
|
|
|
/// Add a line of data (without newline) read from a subtitle file
|
|
|
|
void AddData(std::string const& data) { entry_data = entry_data.get() + data + "\r\n"; }
|
2006-06-30 23:59:20 +02:00
|
|
|
|
2011-12-22 22:15:28 +01:00
|
|
|
/// Extract the contents of this attachment to a file
|
|
|
|
/// @param filename Path to save the attachment to
|
2013-01-04 16:01:50 +01:00
|
|
|
void Extract(agi::fs::path const& filename) const;
|
2011-12-22 22:15:28 +01:00
|
|
|
|
|
|
|
/// Get the name of the attached file
|
|
|
|
/// @param raw If false, remove the SSA filename mangling
|
2013-01-04 16:01:50 +01:00
|
|
|
std::string GetFileName(bool raw=false) const;
|
2006-07-01 05:06:21 +02:00
|
|
|
|
2014-03-08 02:02:32 +01:00
|
|
|
std::string const& GetEntryData() const { return entry_data; }
|
|
|
|
std::string const& GetSSAText() const { return entry_data; }
|
2012-11-26 15:57:58 +01:00
|
|
|
AssEntryGroup Group() const override { return group; }
|
2006-06-30 22:56:16 +02:00
|
|
|
|
2013-12-11 16:55:17 +01:00
|
|
|
AssAttachment(AssAttachment const& rgt);
|
2013-12-09 22:45:28 +01:00
|
|
|
AssAttachment(std::string const& header, AssEntryGroup group);
|
2013-01-04 16:01:50 +01:00
|
|
|
AssAttachment(agi::fs::path const& name, AssEntryGroup group);
|
2006-06-30 22:56:16 +02:00
|
|
|
};
|