tageditor/cli/attachmentinfo.h

47 lines
1.0 KiB
C
Raw Permalink Normal View History

2017-01-15 21:43:46 +01:00
#ifndef CLI_ATTACHMENT_INFO
#define CLI_ATTACHMENT_INFO
2018-03-06 02:04:35 +01:00
#include <tagparser/diagnostics.h>
2018-03-06 23:10:13 +01:00
namespace TagParser {
2017-01-15 21:43:46 +01:00
class AbstractContainer;
class AbstractAttachment;
2018-03-07 01:18:01 +01:00
} // namespace TagParser
2017-01-15 21:43:46 +01:00
namespace Cli {
2018-03-07 01:18:01 +01:00
enum class AttachmentAction { Add, Update, Remove };
2017-01-15 21:43:46 +01:00
2018-03-07 01:18:01 +01:00
class AttachmentInfo {
2017-01-15 21:43:46 +01:00
public:
constexpr AttachmentInfo();
2017-01-15 21:43:46 +01:00
void parseDenotation(const char *denotation);
2018-03-06 23:10:13 +01:00
void apply(TagParser::AbstractContainer *container, TagParser::Diagnostics &diag);
void apply(TagParser::AbstractAttachment *attachment, TagParser::Diagnostics &diag);
2017-01-15 21:43:46 +01:00
void reset();
2018-03-06 23:10:13 +01:00
bool next(TagParser::AbstractContainer *container, TagParser::Diagnostics &diag);
2017-01-15 21:43:46 +01:00
AttachmentAction action;
2019-03-13 19:07:51 +01:00
std::uint64_t id;
2017-01-15 21:43:46 +01:00
bool hasId;
const char *path;
const char *name;
const char *mime;
const char *desc;
};
constexpr AttachmentInfo::AttachmentInfo()
2018-03-07 01:18:01 +01:00
: action(AttachmentAction::Add)
, id(0)
, hasId(false)
, path(nullptr)
, name(nullptr)
, mime(nullptr)
, desc(nullptr)
{
2017-01-15 21:43:46 +01:00
}
2018-03-07 01:18:01 +01:00
} // namespace Cli
2017-01-15 21:43:46 +01:00
#endif // CLI_ATTACHMENT_INFO